You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Tim Foster <tf...@akorri.com> on 2007/05/23 21:05:34 UTC

trouble building a multi-module project with cross-module dependencies

I'm having trouble building a multi-module project structured as below:

 

top

|-- pom.xml

|-- mod1

|    |-- pom.xml

|    |-- mod1A

|    |   |-- pom.xml

|    |   `-- src....

|    |-- mod1B

|        |-- pom.xml

|        `-- src....

|-- mod2

|   |-- pom.xml

|   `-- src....

`src...

 

Additionally, mod1 is listed ahead of mod2 in the top-level pom.xml
file, so I expect mod1 (and thus also its sub-modules) to be processed
first.  Also, mod2 has a dependency on mod1B.  

 

I run 'mvn install' from the top level, expecting it to a) include all
of the phases in the lifecycle up to install as described in the
documentation
(http://maven.apache.org/guides/introduction/introduction-to-the-lifecyc
le.html) and b) to do this recursively.  With that assumption, I think
that mod1B should be installed before mod2 is processed.  But that is
not the case, as the build of mod2 fails because mod1B is not found in
the local repository.  What seems to be happening is that the
sub-modules of mod1 are not being processed, as evidenced by the
following message:

 

    [INFO] No goals needed for project - skipping

 

Rather, the only thing that gets done when processing mod1 when the
command is invoked from the top-level project directory is that the pom
file is installed (i.e., as a result of package type of "pom" for the
module).

 

Now if I change directory into mod1 and run the same 'mvn install'
command, the mod1A and mod1B modules are installed.  Then, I can run
'mvn install' from the top level and the dependency on mod1B is
satisfied when processing mod2.  Obviously I don't want to have this
take multiple invocations of mvn to build my project.  Are my
assumptions correct about how recursion is supposed to work and, if so,
is there something extra I need to do in order to have the sub-modules
down the hierarchy to be processed?  

 

Tim

 


RE: trouble building a multi-module project with cross-module dependencies

Posted by Tim Foster <tf...@akorri.com>.
Wayne, thanks for the reply.  It is interesting to know that Maven
determines the proper build ordering of the modules itself.  As you may
have surmised, the example I described is a simplified version of my
real-life scenario, as I thought it would be easier to understand if I
took out all of the extraneous data.  The real-life pom file that
parallels the mod1 pom does, indeed, have the sub-modules declared.
This is what allows the install of those sub-modules to succeed when, as
I said, I change directory into mod1 and run the same 'mvn install'
command.  It also has the parent pom defined, as it inherits
configuration settings made only in the top-level pom file.  I'm not
sure what dependency would be missing, as it is the unresolved declared
dependency on mod1B that makes the install of mod2 to fail.  Anything
else you or anyone else can think of that I might should look for?


Tim

-----Original Message-----
From: Wayne Fay [mailto:waynefay@gmail.com] 
Sent: Thursday, May 24, 2007 12:16 AM
To: Maven Users List
Subject: Re: trouble building a multi-module project with cross-module
dependencies

As I understand it, ordering of modules in the pom.xml file has nearly
nothing to do with the way the pom is processed by Maven, so that
assumption is incorrect. Maven should automatically find all your poms
(assuming modules are declared) and resolve the proper graph that will
allow it to successfully build your artifacts using the dependencies,
modules, etc you have declared.

It sounds like you are missing either a dependency or more likely a
module/parent declaration in one of your poms, most likely the mod1
pom.xml file. Without seeing all the poms etc I can't be certain, but
that's just what it sounds like.

Wayne

On 5/23/07, Tim Foster <tf...@akorri.com> wrote:
> I'm having trouble building a multi-module project structured as
below:
>
>
>
> top
>
> |-- pom.xml
>
> |-- mod1
>
> |    |-- pom.xml
>
> |    |-- mod1A
>
> |    |   |-- pom.xml
>
> |    |   `-- src....
>
> |    |-- mod1B
>
> |        |-- pom.xml
>
> |        `-- src....
>
> |-- mod2
>
> |   |-- pom.xml
>
> |   `-- src....
>
> `src...
>
>
>
> Additionally, mod1 is listed ahead of mod2 in the top-level pom.xml
> file, so I expect mod1 (and thus also its sub-modules) to be processed
> first.  Also, mod2 has a dependency on mod1B.
>
>
>
> I run 'mvn install' from the top level, expecting it to a) include all
> of the phases in the lifecycle up to install as described in the
> documentation
>
(http://maven.apache.org/guides/introduction/introduction-to-the-lifecyc
> le.html) and b) to do this recursively.  With that assumption, I think
> that mod1B should be installed before mod2 is processed.  But that is
> not the case, as the build of mod2 fails because mod1B is not found in
> the local repository.  What seems to be happening is that the
> sub-modules of mod1 are not being processed, as evidenced by the
> following message:
>
>
>
>    [INFO] No goals needed for project - skipping
>
>
>
> Rather, the only thing that gets done when processing mod1 when the
> command is invoked from the top-level project directory is that the
pom
> file is installed (i.e., as a result of package type of "pom" for the
> module).
>
>
>
> Now if I change directory into mod1 and run the same 'mvn install'
> command, the mod1A and mod1B modules are installed.  Then, I can run
> 'mvn install' from the top level and the dependency on mod1B is
> satisfied when processing mod2.  Obviously I don't want to have this
> take multiple invocations of mvn to build my project.  Are my
> assumptions correct about how recursion is supposed to work and, if
so,
> is there something extra I need to do in order to have the sub-modules
> down the hierarchy to be processed?
>
>
>
> Tim
>
>
>
>

---------------------------------------------------------------------
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: trouble building a multi-module project with cross-module dependencies

Posted by Wayne Fay <wa...@gmail.com>.
As I understand it, ordering of modules in the pom.xml file has nearly
nothing to do with the way the pom is processed by Maven, so that
assumption is incorrect. Maven should automatically find all your poms
(assuming modules are declared) and resolve the proper graph that will
allow it to successfully build your artifacts using the dependencies,
modules, etc you have declared.

It sounds like you are missing either a dependency or more likely a
module/parent declaration in one of your poms, most likely the mod1
pom.xml file. Without seeing all the poms etc I can't be certain, but
that's just what it sounds like.

Wayne

On 5/23/07, Tim Foster <tf...@akorri.com> wrote:
> I'm having trouble building a multi-module project structured as below:
>
>
>
> top
>
> |-- pom.xml
>
> |-- mod1
>
> |    |-- pom.xml
>
> |    |-- mod1A
>
> |    |   |-- pom.xml
>
> |    |   `-- src....
>
> |    |-- mod1B
>
> |        |-- pom.xml
>
> |        `-- src....
>
> |-- mod2
>
> |   |-- pom.xml
>
> |   `-- src....
>
> `src...
>
>
>
> Additionally, mod1 is listed ahead of mod2 in the top-level pom.xml
> file, so I expect mod1 (and thus also its sub-modules) to be processed
> first.  Also, mod2 has a dependency on mod1B.
>
>
>
> I run 'mvn install' from the top level, expecting it to a) include all
> of the phases in the lifecycle up to install as described in the
> documentation
> (http://maven.apache.org/guides/introduction/introduction-to-the-lifecyc
> le.html) and b) to do this recursively.  With that assumption, I think
> that mod1B should be installed before mod2 is processed.  But that is
> not the case, as the build of mod2 fails because mod1B is not found in
> the local repository.  What seems to be happening is that the
> sub-modules of mod1 are not being processed, as evidenced by the
> following message:
>
>
>
>    [INFO] No goals needed for project - skipping
>
>
>
> Rather, the only thing that gets done when processing mod1 when the
> command is invoked from the top-level project directory is that the pom
> file is installed (i.e., as a result of package type of "pom" for the
> module).
>
>
>
> Now if I change directory into mod1 and run the same 'mvn install'
> command, the mod1A and mod1B modules are installed.  Then, I can run
> 'mvn install' from the top level and the dependency on mod1B is
> satisfied when processing mod2.  Obviously I don't want to have this
> take multiple invocations of mvn to build my project.  Are my
> assumptions correct about how recursion is supposed to work and, if so,
> is there something extra I need to do in order to have the sub-modules
> down the hierarchy to be processed?
>
>
>
> Tim
>
>
>
>

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


Re: trouble building a multi-module project with cross-module dependencies

Posted by Andrew Williams <an...@handyande.co.uk>.
my guess is that your mod1/pom.xml is missing the

<modules>
   <module>mod1A</module>
   <module>mod1B</module>
</modules>

Andy

On 23 May 2007, at 20:05, Tim Foster wrote:

> I'm having trouble building a multi-module project structured as  
> below:
>
>
>
> top
>
> |-- pom.xml
>
> |-- mod1
>
> |    |-- pom.xml
>
> |    |-- mod1A
>
> |    |   |-- pom.xml
>
> |    |   `-- src....
>
> |    |-- mod1B
>
> |        |-- pom.xml
>
> |        `-- src....
>
> |-- mod2
>
> |   |-- pom.xml
>
> |   `-- src....
>
> `src...
>
>
>
> Additionally, mod1 is listed ahead of mod2 in the top-level pom.xml
> file, so I expect mod1 (and thus also its sub-modules) to be processed
> first.  Also, mod2 has a dependency on mod1B.
>
>
>
> I run 'mvn install' from the top level, expecting it to a) include all
> of the phases in the lifecycle up to install as described in the
> documentation
> (http://maven.apache.org/guides/introduction/introduction-to-the- 
> lifecyc
> le.html) and b) to do this recursively.  With that assumption, I think
> that mod1B should be installed before mod2 is processed.  But that is
> not the case, as the build of mod2 fails because mod1B is not found in
> the local repository.  What seems to be happening is that the
> sub-modules of mod1 are not being processed, as evidenced by the
> following message:
>
>
>
>     [INFO] No goals needed for project - skipping
>
>
>
> Rather, the only thing that gets done when processing mod1 when the
> command is invoked from the top-level project directory is that the  
> pom
> file is installed (i.e., as a result of package type of "pom" for the
> module).
>
>
>
> Now if I change directory into mod1 and run the same 'mvn install'
> command, the mod1A and mod1B modules are installed.  Then, I can run
> 'mvn install' from the top level and the dependency on mod1B is
> satisfied when processing mod2.  Obviously I don't want to have this
> take multiple invocations of mvn to build my project.  Are my
> assumptions correct about how recursion is supposed to work and, if  
> so,
> is there something extra I need to do in order to have the sub-modules
> down the hierarchy to be processed?
>
>
>
> Tim
>
>
>


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