You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Iron Eagle <Ir...@gmx.at> on 2010/10/02 01:12:03 UTC

Dependencies between modules of a multi module project

Hi there,

I have a multi module project with a parent, module A and module B. I configured each module pom with the parent and added the modules to the parent pom.

Module B depends on module A, so I added the dependency in module B. When I now package or compile the entire project within the parent directory, first module A is created and then module B is creates successfully with module A.

But when I try to compile module B within the directory of module B, maven tells me, that the dependency to module A can not be resolved. Can this behaviour changed, so that it is possible to compile module B within its directory successfully?
-- 
GMX DSL Doppel-Flat ab 19,99 &euro;/mtl.! Jetzt auch mit 
gratis Notebook-Flat! http://portal.gmx.net/de/go/dsl

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


Re: Dependencies between modules of a multi module project

Posted by Ron Wheeler <rw...@artifact-software.com>.
Do  you have your Nexus or other repository set up?
Maven will fall into place much better once you have this working.
You build your dependencies first, deploy them as SNAPSHOTS which puts 
them into your team's repository and then Eclipse and Maven will build 
your dependent modules painlessly.
When you are ready to release, repeat the process with release versions 
and it all works seamlessly.

General advice to all new Maven users.
If you are having trouble with Maven, try to think what it is that you 
are building that is so different from regular software.
If you are trying to build something that other people do and you are 
having trouble, you are doing something wrong.
Don't try to fix or bend Maven, change your development process so that 
it follows the Maven way.
Or don't use Maven unless you want to be completely frustrated and spend 
many hours in the forum and modifying plug-ins.

Ron

On 03/10/2010 12:46 PM, Iron Eagle wrote:
> Thank you. Importing the parent pom into eclipse solved the problem. Now all dependencies are resolved correctly within eclipse and all artifacts are build successfully.
>
> The only thing, that is still not working, is building module A (that depends on module B) within the directory of module A (and without having installed module B before). But if I understand it correctly, this is a design issue of maven.
>
> best reagrds
>
> -------- Original-Nachricht --------
>> Datum: Sat, 02 Oct 2010 15:02:26 -0400
>> Von: Marshall Schor<ms...@schor.com>
>> An: Maven Users List<us...@maven.apache.org>
>> Betreff: Re: Dependencies between modules of a multi module project
>>   m2eclipse supports both styles of dependency resolution -
>> 1) resolving using normal maven dependency resolution (usually, the
>> prebuilt jar
>> in the .m2 local repository), or
>> 2) from the current workspace (allowing you to "pick up" changes there,
>> even if
>> the other project(s) weren't built/installed.
>>
>> This is described in the m2eclipse book, here:
>> http://www.sonatype.com/books/m2eclipse-book/reference/dependencies.html#dependencies-sect-resolving-dependencies
>>
>> -Marshall Schor
>>
>> On 10/2/2010 7:22 AM, Antonio Petrelli wrote:
>>> 2010/10/2 Iron Eagle<Ir...@gmx.at>:
>>>> Some times, I use the command line (there its no problem). But most
>> time, I use eclipse. I've searched for a tutorial for that problem, but the
>> result doesn't really satisfy me.
>>> If you use m2eclipse and you checkout the entire main pom project as
>>> Maven project, the project created for module B will have a reference
>>> to the project for module A.
>>>
>>> Antonio
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>


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


Re: Dependencies between modules of a multi module project

Posted by Antonio Petrelli <an...@gmail.com>.
2010/10/3 Iron Eagle <Ir...@gmx.at>:
> The only thing, that is still not working, is building module A (that depends on module B) within the directory of module A (and without having installed module B before). But if I understand it correctly, this is a design issue of maven.

A design *feature*, not an issue.

Antonio

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


Re: Dependencies between modules of a multi module project

Posted by Iron Eagle <Ir...@gmx.at>.
Thank you. Importing the parent pom into eclipse solved the problem. Now all dependencies are resolved correctly within eclipse and all artifacts are build successfully.

The only thing, that is still not working, is building module A (that depends on module B) within the directory of module A (and without having installed module B before). But if I understand it correctly, this is a design issue of maven.

best reagrds

-------- Original-Nachricht --------
> Datum: Sat, 02 Oct 2010 15:02:26 -0400
> Von: Marshall Schor <ms...@schor.com>
> An: Maven Users List <us...@maven.apache.org>
> Betreff: Re: Dependencies between modules of a multi module project

>  m2eclipse supports both styles of dependency resolution -
> 1) resolving using normal maven dependency resolution (usually, the
> prebuilt jar
> in the .m2 local repository), or
> 2) from the current workspace (allowing you to "pick up" changes there,
> even if
> the other project(s) weren't built/installed.
> 
> This is described in the m2eclipse book, here:
> http://www.sonatype.com/books/m2eclipse-book/reference/dependencies.html#dependencies-sect-resolving-dependencies
> 
> -Marshall Schor
> 
> On 10/2/2010 7:22 AM, Antonio Petrelli wrote:
> > 2010/10/2 Iron Eagle <Ir...@gmx.at>:
> >> Some times, I use the command line (there its no problem). But most
> time, I use eclipse. I've searched for a tutorial for that problem, but the
> result doesn't really satisfy me.
> > If you use m2eclipse and you checkout the entire main pom project as
> > Maven project, the project created for module B will have a reference
> > to the project for module A.
> >
> > Antonio
> >
> > ---------------------------------------------------------------------
> > 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
> 

-- 
GMX.at - Österreichs FreeMail-Dienst mit über 2 Mio Mitgliedern
E-Mail, SMS & mehr! Kostenlos: http://portal.gmx.net/de/go/atfreemail

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


Re: Dependencies between modules of a multi module project

Posted by Marshall Schor <ms...@schor.com>.
 m2eclipse supports both styles of dependency resolution -
1) resolving using normal maven dependency resolution (usually, the prebuilt jar
in the .m2 local repository), or
2) from the current workspace (allowing you to "pick up" changes there, even if
the other project(s) weren't built/installed.

This is described in the m2eclipse book, here:
http://www.sonatype.com/books/m2eclipse-book/reference/dependencies.html#dependencies-sect-resolving-dependencies

-Marshall Schor

On 10/2/2010 7:22 AM, Antonio Petrelli wrote:
> 2010/10/2 Iron Eagle <Ir...@gmx.at>:
>> Some times, I use the command line (there its no problem). But most time, I use eclipse. I've searched for a tutorial for that problem, but the result doesn't really satisfy me.
> If you use m2eclipse and you checkout the entire main pom project as
> Maven project, the project created for module B will have a reference
> to the project for module A.
>
> Antonio
>
> ---------------------------------------------------------------------
> 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


Re: Dependencies between modules of a multi module project

Posted by Antonio Petrelli <an...@gmail.com>.
2010/10/2 Iron Eagle <Ir...@gmx.at>:
> Some times, I use the command line (there its no problem). But most time, I use eclipse. I've searched for a tutorial for that problem, but the result doesn't really satisfy me.

If you use m2eclipse and you checkout the entire main pom project as
Maven project, the project created for module B will have a reference
to the project for module A.

Antonio

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


Re: Dependencies between modules of a multi module project

Posted by Iron Eagle <Ir...@gmx.at>.
Hi,

yes, you are right. My problem is indeed, that mvn install must be called everytime, when I change something in the module, another module depends on.

Some times, I use the command line (there its no problem). But most time, I use eclipse. I've searched for a tutorial for that problem, but the result doesn't really satisfy me.

How do you handle that problem? Is there a best practise?

best regards

-------- Original-Nachricht --------
> Datum: Fri, 1 Oct 2010 21:35:58 -0400
> Von: Wendy Smoak <ws...@gmail.com>
> An: Maven Users List <us...@maven.apache.org>
> Betreff: Re: Dependencies between modules of a multi module project

> On Fri, Oct 1, 2010 at 8:08 PM, Jon Paynter <ki...@gmail.com> wrote:
> > I suspect we are missing something in the way maven was designed to
> work.
> >  How is multi-module development intended to work?
> 
> You have it right.  Maven will not go build a sibling module, it will
> use what's in the local repository.
> 
> Most IDEs are capable of watching for changes and re-compiling on the
> fly so that you have the latest available.
> 
> If you are working from the command line and want that behavior, you
> need to build from the top.
> 
> -- 
> Wendy
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

-- 
Sicherer, schneller und einfacher. Die aktuellen Internet-Browser -
jetzt kostenlos herunterladen! http://portal.gmx.net/de/go/atbrowser

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


Re: Dependencies between modules of a multi module project

Posted by Wendy Smoak <ws...@gmail.com>.
On Fri, Oct 1, 2010 at 8:08 PM, Jon Paynter <ki...@gmail.com> wrote:
> I suspect we are missing something in the way maven was designed to work.
>  How is multi-module development intended to work?

You have it right.  Maven will not go build a sibling module, it will
use what's in the local repository.

Most IDEs are capable of watching for changes and re-compiling on the
fly so that you have the latest available.

If you are working from the command line and want that behavior, you
need to build from the top.

-- 
Wendy

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


Re: Dependencies between modules of a multi module project

Posted by Jon Paynter <ki...@gmail.com>.
I run into the same problems...
running mvn install, puts module 'A' in your local repository where it can
be found when doing a compile for module 'B'

-but-
if im doing development on both modules.. I dont want the old version of
module 'A' to be used when im compiling module 'B' - I want it to pick up my
latest changes.

I suspect we are missing something in the way maven was designed to work.
 How is multi-module development intended to work?

On Fri, Oct 1, 2010 at 4:38 PM, David Jencks <da...@yahoo.com> wrote:

> Have you run mvn install?
>
> david jencks
>
> On Oct 1, 2010, at 4:12 PM, Iron Eagle wrote:
>
> > Hi there,
> >
> > I have a multi module project with a parent, module A and module B. I
> configured each module pom with the parent and added the modules to the
> parent pom.
> >
> > Module B depends on module A, so I added the dependency in module B. When
> I now package or compile the entire project within the parent directory,
> first module A is created and then module B is creates successfully with
> module A.
> >
> > But when I try to compile module B within the directory of module B,
> maven tells me, that the dependency to module A can not be resolved. Can
> this behaviour changed, so that it is possible to compile module B within
> its directory successfully?
> > --
> > GMX DSL Doppel-Flat ab 19,99 €/mtl.! Jetzt auch mit
> > gratis Notebook-Flat! http://portal.gmx.net/de/go/dsl
> >
> > ---------------------------------------------------------------------
> > 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
>
>

Re: Dependencies between modules of a multi module project

Posted by David Jencks <da...@yahoo.com>.
Have you run mvn install?

david jencks

On Oct 1, 2010, at 4:12 PM, Iron Eagle wrote:

> Hi there,
> 
> I have a multi module project with a parent, module A and module B. I configured each module pom with the parent and added the modules to the parent pom.
> 
> Module B depends on module A, so I added the dependency in module B. When I now package or compile the entire project within the parent directory, first module A is created and then module B is creates successfully with module A.
> 
> But when I try to compile module B within the directory of module B, maven tells me, that the dependency to module A can not be resolved. Can this behaviour changed, so that it is possible to compile module B within its directory successfully?
> -- 
> GMX DSL Doppel-Flat ab 19,99 &euro;/mtl.! Jetzt auch mit 
> gratis Notebook-Flat! http://portal.gmx.net/de/go/dsl
> 
> ---------------------------------------------------------------------
> 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