You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Ren <re...@gmail.com> on 2009/10/14 08:38:01 UTC

Re: Compilation failure due to looking at installed artifact instead for in project

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?

Cheers,
Ren


On Wed, Sep 9, 2009 at 7:16 PM, Stephen Connolly
<st...@gmail.com> 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 <jo...@gmail.com>
>
>> 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 <an...@hammar.net>:
>> > 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 <jonsson.thomas@gmail.com
>> >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: users-unsubscribe@maven.apache.org
>> >> For additional commands, e-mail: users-help@maven.apache.org
>> >>
>> >>
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>



-- 
Kind Regards,
Ren

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Compilation failure due to looking at installed artifact instead for in project

Posted by Stephen Connolly <st...@gmail.com>.
2009/10/14 Ren <re...@gmail.com>

> 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
> <st...@gmail.com> 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 <jo...@gmail.com>
> >
> >> 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 <an...@hammar.net>:
> >> > 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 <
> jonsson.thomas@gmail.com
> >> >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: users-unsubscribe@maven.apache.org
> >> >> For additional commands, e-mail: users-help@maven.apache.org
> >> >>
> >> >>
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: users-help@maven.apache.org
> >>
> >>
> >
>
>
>
> --
> Kind Regards,
> Ren
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Compilation failure due to looking at installed artifact instead for in project

Posted by Ren <re...@gmail.com>.
Hi Stephen,
I think I just figured out myself.
I have use the -am argument. So it's like:

mvn package -am -pl ear

Cheers
Ren

On Wed, Oct 14, 2009 at 5:38 PM, Ren <re...@gmail.com> wrote:
> 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?
>
> Cheers,
> Ren
>
>
> On Wed, Sep 9, 2009 at 7:16 PM, Stephen Connolly
> <st...@gmail.com> 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 <jo...@gmail.com>
>>
>>> 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 <an...@hammar.net>:
>>> > 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 <jonsson.thomas@gmail.com
>>> >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: users-unsubscribe@maven.apache.org
>>> >> For additional commands, e-mail: users-help@maven.apache.org
>>> >>
>>> >>
>>> >
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>
>
>
>
> --
> Kind Regards,
> Ren
>



-- 
Kind Regards,
Ren

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org