You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by n000b <us...@yahoo.com> on 2009/06/25 16:51:03 UTC

Adding Dependency of other Child Project

Hi*!

I am moving my project from ant to maven2. My project consists of multiple
modules (ejbs/wars). I have created a base/parent project and added modules
to it, so far so good. 

Now, some of my projects depend upon some other child projects of the same
parent to be built i.e. Child B depend upon Child A. I can build the Child A
project (going to Child A dir and executing the "mvn package" command. This
generates a jar file (which is needed for the Child B project). How can I
let the Child B to know that the Child A has been build & the jar is added
to the class path while building the Child B project.

Thanks in advance for your time!
-- 
View this message in context: http://www.nabble.com/Adding-Dependency-of-other-Child-Project-tp24204718p24204718.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Adding Dependency of other Child Project

Posted by Wendy Smoak <ws...@gmail.com>.
On Fri, Jun 26, 2009 at 1:40 AM, n000b<us...@yahoo.com> wrote:

> Thanks for your reply Wendy. I did try the same, but maven cannot resolve the
> artifact. Do I need to install the artifact somewhere (we are using an
> archiva online repository, but I would prefer to have the artifact installed
> to some local directory), so that it can be used for the Child Project B
> from the local dir.
>
> Any way to achieve this?

What are you doing now, and what does the project structure look like?

The dependency snippet I provided assumes that you have a parent pom
above the two children.  If so, then building "from the top" (from the
directory with the parent pom) should work.

Try 'mvn install' in A and then in B.  This will install the artifacts
into your local repository and they will be available for you to use
when building other projects.

-- 
Wendy

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


Re: Adding Dependency of other Child Project

Posted by n000b <us...@yahoo.com>.
Thanks for your reply Wendy. I did try the same, but maven cannot resolve the
artifact. Do I need to install the artifact somewhere (we are using an
archiva online repository, but I would prefer to have the artifact installed
to some local directory), so that it can be used for the Child Project B
from the local dir.

Any way to achieve this?

Thanks!


Wendy Smoak-3 wrote:
> 
> On Thu, Jun 25, 2009 at 7:51 AM, n000b<us...@yahoo.com> wrote:
> 
>> How can I
>> let the Child B to know that the Child A has been build & the jar is
>> added
>> to the class path while building the Child B project.
> 
> I think you answered it in your subject line. :)  Add a dependency in B's
> pom:
> 
> <dependency>
>   <groupId>my.group</groupId>
>   <artifactId>A</artifactId>
>   <version>${project.version}</version>
> </dependency>
> 
> -- 
> Wendy
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Adding-Dependency-of-other-Child-Project-tp24204718p24216869.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Adding Dependency of other Child Project

Posted by Wendy Smoak <ws...@gmail.com>.
On Thu, Jun 25, 2009 at 7:51 AM, n000b<us...@yahoo.com> wrote:

> How can I
> let the Child B to know that the Child A has been build & the jar is added
> to the class path while building the Child B project.

I think you answered it in your subject line. :)  Add a dependency in B's pom:

<dependency>
  <groupId>my.group</groupId>
  <artifactId>A</artifactId>
  <version>${project.version}</version>
</dependency>

-- 
Wendy

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