You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by mark_in_gr <mc...@xrite.com> on 2007/03/02 23:12:08 UTC

Multi-module compile of dependency from parent

I have a multi-module project which is basically structured like this:

parent(pom only)
---module1
---module2
---module3

Module3 has Module1 and Module2 as dependencies. My question is: if I make a
source code change in a class in Module1, I would like to simply to a
Build(package or install) at the Module3 Level without having to do a clean
first. Is this possible?

It looks like it is not. Unlike ant based projects I have worked with, it
appears that with Maven2, whether you use package(which would resolve the
Module1 dependency from the target directory) or install(which would take
Module1 from the local repo), the existing artifact for Module1, either the
target or local repo, is being used as a dependency when building(mvn
compile) Module3. The only way I can get maven to recognize source code
updates in Module1 is to first do a mvn clean . . . followed by package.

Bottom line . . . is there anyway to JUST build a modules dependency
artifact when compiling the parent module, without doing a clean first?
-- 
View this message in context: http://www.nabble.com/Multi-module-compile-of-dependency-from-parent-tf3336285s177.html#a9278428
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: [m2] Multi-module compile of dependency from parent

Posted by mark_in_gr <mc...@xrite.com>.
Actually the problem is this: 

When running package or install on the top level parent(POM only, w/list of
modules), if I force a compile time error in the source code of a class in
Module1, the error is not detected in Module3. If I do a clean install, the
compile time error IS detected by Module3. 

I suspect the problem is because I have the project structured like so:

Highest Level Parent Pom
----Module 1
----Module 2
----Module 3
----Module 4
----Module 5
----Module 6
----Module 7

Not only does Module 3 have Module 1 and 2 as dependencies, but so does
Module 4. The Module 1 and 2 dependencies in Modules 3 and 4 are structured
just like any other dependencie(groupId, artifactId, etc.) so this would
mean they are coming from the local repo. However, the parent/child
relationship is determined by the Highest Level Parent Pom, so how does
Maven know that Module 3 and 4 must be re-built(package) when an object in
Module 1 or 2 has been changed? The only way I know how to force this to
happen is do a mvn clean package/install. When I do a mvn package/install at
the Highest Level Parent Pom, Maven does not know that it has to re-buil3
Module 3 and 4 because one of their dependencies has changed(in this case,
Module 1). I thought that was all part of the snapshot process? Is there
something I am missing in my pom structure? Do I need to adjust the
parent/child relationships? I was under the impression that a module could
only have one parent.

Nick Stolwijk wrote:
> 
> As far as I know, when you do a mvn install the new code from Module1 
> would be compiled and installed in the local repo as snapshot. After 
> that Module3 would use that snapshot to build. The package lifecycle is 
> just one step too early to fix the dependencies. Ofcourse, you have to 
> do the mvn install at the parent directory, otherwise the new snapshot 
> version wouldn't be build.
> 
> Hth,
> 
> Nick Stolwijk
> 
> 
> mark_in_gr wrote:
>> I have a multi-module project which is basically structured like this:
>>
>> parent(pom only)
>> ---module1
>> ---module2
>> ---module3
>>
>> Module3 has Module1 and Module2 as dependencies. My question is: if I
>> make a
>> source code change in a class in Module1, I would like to simply to a
>> Build(package or install) at the Module3 Level without having to do a
>> clean
>> first. Is this possible?
>>
>> It looks like it is not. Unlike ant based projects I have worked with, it
>> appears that with Maven2, whether you use package(which would resolve the
>> Module1 dependency from the target directory) or install(which would take
>> Module1 from the local repo), the existing artifact for Module1, either
>> the
>> target or local repo, is being used as a dependency when building(mvn
>> compile) Module3. The only way I can get maven to recognize source code
>> updates in Module1 is to first do a mvn clean . . . followed by package.
>>
>> Bottom line . . . is there anyway to JUST build a modules dependency
>> artifact when compiling the parent module, without doing a clean first?
>>   
> 
> 
> ---------------------------------------------------------------------
> 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/Multi-module-compile-of-dependency-from-parent-tf3336285s177.html#a9314209
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: Multi-module compile of dependency from parent

Posted by Nick Stolwijk <ni...@planet.nl>.
As far as I know, when you do a mvn install the new code from Module1 
would be compiled and installed in the local repo as snapshot. After 
that Module3 would use that snapshot to build. The package lifecycle is 
just one step too early to fix the dependencies. Ofcourse, you have to 
do the mvn install at the parent directory, otherwise the new snapshot 
version wouldn't be build.

Hth,

Nick Stolwijk


mark_in_gr wrote:
> I have a multi-module project which is basically structured like this:
>
> parent(pom only)
> ---module1
> ---module2
> ---module3
>
> Module3 has Module1 and Module2 as dependencies. My question is: if I make a
> source code change in a class in Module1, I would like to simply to a
> Build(package or install) at the Module3 Level without having to do a clean
> first. Is this possible?
>
> It looks like it is not. Unlike ant based projects I have worked with, it
> appears that with Maven2, whether you use package(which would resolve the
> Module1 dependency from the target directory) or install(which would take
> Module1 from the local repo), the existing artifact for Module1, either the
> target or local repo, is being used as a dependency when building(mvn
> compile) Module3. The only way I can get maven to recognize source code
> updates in Module1 is to first do a mvn clean . . . followed by package.
>
> Bottom line . . . is there anyway to JUST build a modules dependency
> artifact when compiling the parent module, without doing a clean first?
>   


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