You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Michael Fiedler <mf...@wernervas.com> on 2005/12/05 19:45:28 UTC

compile time check

I have the following structure where JAR2 depends on JAR1.

Parent
|- pom.xml
|
|- JAR1
|   |- pom.xml
|   
|
|- JAR2
|   |- pom.xml


The JAR1 and JAR2 projects are developed concurrently, and pom.xml of JAR2 lists JAR1 as a dependency. 

The parent pom.xml lists JAR1 and JAR2 as modules.

All of this builds fine the first time when I execute 'm2 install' on the Parent pom.xml file. But if I make a change to a class in JAR1 which would cause a compile error in JAR2, this compile error is not being caught when I run 'm2 install' at the parent pom.xml. The only way I can get this to work is to run 'm2 clean install', and then I am able to see the failure in JAR2. But I don't want to run 'clean' every time I do a build.

Has anyone else come across this issue? Any workarounds?

Thank you,
Michael Fiedler


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


Re: compile time check

Posted by Edwin Punzalan <ep...@exist.com>.
This is a classic example of how maven handles its artifacts.  And the 
key to explain this behavior is the local repository.

When you build your multiproject for the first time, what happens is 
maven will build jar1 first and update your local repository copy since 
jar2 depends on it.  Then maven will build jar2 which will then use the 
updated copy of jar1 in the local repository.

But when do a change in jar1, then build jar2, what happens is when 
building jar2, it will use the jar1 copy in the local repository which 
has not been updated.  To achieve what you want, after doing some 
changes in jar1, do a "mvn install" on jar1 first, then when you do "mvn 
install" on jar2, it will then fail as that is what you want.

Just remember to install the project after your edits, so other projects 
can see what you've changed in the local repository.

^_^



Michael Fiedler wrote:

>I have the following structure where JAR2 depends on JAR1.
>
>Parent
>|- pom.xml
>|
>|- JAR1
>|   |- pom.xml
>|   
>|
>|- JAR2
>|   |- pom.xml
>
>
>The JAR1 and JAR2 projects are developed concurrently, and pom.xml of JAR2 lists JAR1 as a dependency. 
>
>The parent pom.xml lists JAR1 and JAR2 as modules.
>
>All of this builds fine the first time when I execute 'm2 install' on the Parent pom.xml file. But if I make a change to a class in JAR1 which would cause a compile error in JAR2, this compile error is not being caught when I run 'm2 install' at the parent pom.xml. The only way I can get this to work is to run 'm2 clean install', and then I am able to see the failure in JAR2. But I don't want to run 'clean' every time I do a build.
>
>Has anyone else come across this issue? Any workarounds?
>
>Thank you,
>Michael Fiedler
>
>
>---------------------------------------------------------------------
>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