2009/10/14 Ren <[email protected]>

> Hello Stephen,
> I have a similar problem and still couldn't resolve.
> My project has three sub modules: war, ear, and lib, both war and ear
> depend on lib. I made a parent project to include all three modules.
> (A very typical setup I guess).
>
> When I want to build just ear, I uses
>  mvn package -pl ear
> and if I don't have lib module installed in my local repository it
> complains artifact not found.
>
> Is there a way to force maven to look for dependency from other
> sub-modules first before going to local repository?
>

yes, don't use -pl ;-)


>
> Cheers,
> Ren
>
>
> On Wed, Sep 9, 2009 at 7:16 PM, Stephen Connolly
> <[email protected]> wrote:
> > you need to build at least as far as the package phase of the
> lifecycle...
> > and you might even want to go as far as install...
> >
> > the jar file is not built until the package phase, so you will get these
> > errors if you do not go as far as package..
> >
> > also if you do builds of sub modules independently, then you will need to
> go
> > as far as install as package will only keep the jar artifact within the
> > reactor, and once maven stops running, that reactor is thrown away, so
> that
> > the next build will not have access to the artifact.  going as far as
> > install will push the reactor artifacts into the local repository, which
> > then makes the artifacts available to subsequent maven invokations
> >
> > -Stephen
> >
> > 2009/9/9 Thomas Jonsson <[email protected]>
> >
> >> Hi!
> >>
> >> No, I'm buiding from project root.
> >> I just tested with Maven 2.0.10 with no compilation failures. But if I
> >> remove the core articfact from local repo it complains about it's
> >> missing.
> >>
> >> /Thomas
> >>
> >>
> >> 2009/9/9 Anders Hammar <[email protected]>:
> >> > I guess you're building from the 'integration' project, not the
> >> aggregating
> >> > project (ejbs)?
> >> > If that's the case, your scenario is the expected way for it to work.
> >> Your
> >> > dependency is to an artifact (the built jar), not a Maven project on
> your
> >> > local disk. So you need to build the core project first. If you build
> >> from
> >> > the aggregating project it will be handled correctly. Or you use some
> >> tool
> >> > to help you (m2eclipse).
> >> > If you find yourself updating updating two different projects, then
> your
> >> > separation might not be right.
> >> >
> >> > /Anders
> >> >
> >> > On Wed, Sep 9, 2009 at 09:17, Thomas Jonsson <
> [email protected]
> >> >wrote:
> >> >
> >> >> Hi!
> >> >>
> >> >> I was just wondering if have misunderstood the basics of Maven and
> >> >> dependencies.
> >> >> I have a project according to this structure:
> >> >>
> >> >> ear
> >> >> ejbs
> >> >>   core
> >> >>   integration
> >> >> webapps
> >> >>   webapp
> >> >>
> >> >> integration is dependent on core.
> >> >>
> >> >> from pom in integration.xml:
> >> >> <dependency>
> >> >>        <groupId>com.jf.application.ejbs</groupId>
> >> >>        <artifactId>core</artifactId>
> >> >>        <version>${pom.version}</version>
> >> >>        <scope>compile</scope>
> >> >> </dependency>
> >> >>
> >> >> pom in ejbs:
> >> >>
> >> >> <project xmlns="http://maven.apache.org/POM/4.0.0";
> >> >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> >> >> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> >> >> http://maven.apache.org/maven-v4_0_0.xsd";>
> >> >>   <modelVersion>4.0.0</modelVersion>
> >> >>   <groupId>com.jf.application</groupId>
> >> >>   <artifactId>ejbs</artifactId>
> >> >>   <packaging>pom</packaging>
> >> >>   <name>ejbs</name>
> >> >>   <parent>
> >> >>      <groupId>com.jf</groupId>
> >> >>      <artifactId>application</artifactId>
> >> >>      <version>2010v-SNAPSHOT</version>
> >> >>   </parent>
> >> >>
> >> >>   <modules>
> >> >>      <module>core</module>
> >> >>      <module>integration</module>
> >> >>    </modules>
> >> >> </project>
> >> >>
> >> >> When a run mvn clean:compile in the project root a I get a
> compilation
> >> >> error saying that a method is missing. I recently added the method in
> >> >> one of the classes in the core project. When I debug a see that the
> >> >> classpath for core is the installed artifact in the local maven repo
> >> >> and not the classpath to core in the project. Should it be this way?
> >> >> I think it seems silly that I have to install the core artifact
> first.
> >> >>
> >> >> I'm running Maven 2.2.1 on windows.
> >> >>
> >> >> Any ideas?
> >> >>
> >> >> Best regards,
> >> >> Thomas
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: [email protected]
> >> >> For additional commands, e-mail: [email protected]
> >> >>
> >> >>
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [email protected]
> >> For additional commands, e-mail: [email protected]
> >>
> >>
> >
>
>
>
> --
> Kind Regards,
> Ren
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to