You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Nick Stolwijk <ni...@gmail.com> on 2009/07/01 11:04:06 UTC

Re: How force Maven to compile each project/module even if there are no changes

Run a clean before your compile, thus "mvn clean compile" or "mvn
clean install". This will clean out the target directory of each
project before compiling. The skipped java files is not really a maven
issue, it is the java compiler which detect which files are changed.

Hth,

Nick Stolwijk
~Java Developer~

Iprofs BV.
Claus Sluterweg 125
2012 WS Haarlem
www.iprofs.nl



On Wed, Jul 1, 2009 at 10:41 AM, Nafter<Hd...@allshare.nl> wrote:
>
> How can I force Maven to compile each project/module even if there are no
> changes.
>
> Because Maven automatically calculates the order in which the various
> projects/modules have to be compiled. This is done by checking the module
> dependencies.
>
> For instance this is the order:
>
> - project D;
> - project A;
> - project C;
> - project B;
>
> In the above example project D is not dependendent on an other project. But
> for instance project B is dependent on project D, A and C.
>
> Now let's say we change an interface method within project A. An implementor
> of this interface is located for instance in project B.
>
> But now we only commit the change of the interface in project A and we
> forget to commit the change of the implementor in project B.
>
> Now when Maven builds the WAR it says for project B there is nothing to
> compile -all classes are up to date.
> So nothing is done here.
>
> However we do have a compilation error now!!! And Maven did not detect it.
> So I would like Maven to always do a complete compile of each project.
>
> Does anyone know how to accomplish this?
> Thanks in advance.
> --
> View this message in context: http://www.nabble.com/How-force-Maven-to-compile-each-project-module-even-if-there-are-no-changes-tp24286239p24286239.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
>
>

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


Re: How force Maven to compile each project/module even if there are no changes

Posted by Nafter <Hd...@allshare.nl>.
Hi Baptiste,

Thanks for taking a look at the pom.xml.
I do have my reasons for building the WAR using ANT. Normally I would use
the required plugin for that, but since I have to hassle around a bit on the
maven server with libraries I was forced to do it this way.

But to be complete I indeed trigger the build by the following command:
-e clean install -Dload_properties -Drun_dummy_test -Drebuild_war
-Drun_tests

So as you can see the different profiles are being triggered. And normally
by calling the same maven command WITHOUT "clean" the -Drun_tests is
actually kicking off the unit tests.
But now since I added the "clean" option, none of the tests are being
executed any longer.
Strange.



Baptiste MATHUS wrote:
> 
> I didn't understand what could prevent your tests from being run, since
> it's
> just automatic and a kind of prerequisite of the install goal (just before
> package, actually, you should read
> http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Build_Lifecycle_Basics
> ).
> 
> I just had a look at your pom. Woaw... I understand why it gets so
> complicated for you... Your pom seems sooo complicated to me. I don't
> completely understand why you need to run ant to create a war. But anyway.
> 
> Though it's difficult to read, I'm wondering if you didn't forget to
> activate some profile? Are you sure the previous command was only "mvn
> compile" and not something like "mvn compile -Drun_tests=true" ?
> 
> Cheers
> 
> 2009/7/2 Nafter <Hd...@allshare.nl>
> 
>>
>> Hi Nick,
>>
>> Thanks for your reply.
>>
>> I adjusted the maven goals/options to indeed use "mvn clean instal ....".
>> The result of this change was ok. All projects are now compiled even if
>> there are no changes.
>> However no none of the JUnit tests are being executed.
>> Normally about 400 JUnit tests are being executed, but because of the
>> clean
>> command nothing is being executed now.
>> Do you know what I need to change to make sure the Unit tests are
>> executed
>> again.
>> See attached pom file. At line 457 the call for the JUnit tests is
>> described.
>> Thanks.
>>
>> Hugo
>>
>>
>> http://www.nabble.com/file/p24302688/pom.xml pom.xml
>>
>> Nick Stolwijk-4 wrote:
>> >
>> > Run a clean before your compile, thus "mvn clean compile" or "mvn
>> > clean install". This will clean out the target directory of each
>> > project before compiling. The skipped java files is not really a maven
>> > issue, it is the java compiler which detect which files are changed.
>> >
>> > Hth,
>> >
>> > Nick Stolwijk
>> > ~Java Developer~
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/How-force-Maven-to-compile-each-project-module-even-if-there-are-no-changes-tp24286239p24302688.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
>>
>>
> 
> 
> -- 
> Baptiste <Batmat> MATHUS - http://batmat.net
> Sauvez un arbre,
> Mangez un castor !
> 
> 

-- 
View this message in context: http://www.nabble.com/How-force-Maven-to-compile-each-project-module-even-if-there-are-no-changes-tp24286239p24318562.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: How force Maven to compile each project/module even if there are no changes

Posted by Baptiste MATHUS <ml...@batmat.net>.
I didn't understand what could prevent your tests from being run, since it's
just automatic and a kind of prerequisite of the install goal (just before
package, actually, you should read
http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Build_Lifecycle_Basics
).

I just had a look at your pom. Woaw... I understand why it gets so
complicated for you... Your pom seems sooo complicated to me. I don't
completely understand why you need to run ant to create a war. But anyway.

Though it's difficult to read, I'm wondering if you didn't forget to
activate some profile? Are you sure the previous command was only "mvn
compile" and not something like "mvn compile -Drun_tests=true" ?

Cheers

2009/7/2 Nafter <Hd...@allshare.nl>

>
> Hi Nick,
>
> Thanks for your reply.
>
> I adjusted the maven goals/options to indeed use "mvn clean instal ....".
> The result of this change was ok. All projects are now compiled even if
> there are no changes.
> However no none of the JUnit tests are being executed.
> Normally about 400 JUnit tests are being executed, but because of the clean
> command nothing is being executed now.
> Do you know what I need to change to make sure the Unit tests are executed
> again.
> See attached pom file. At line 457 the call for the JUnit tests is
> described.
> Thanks.
>
> Hugo
>
>
> http://www.nabble.com/file/p24302688/pom.xml pom.xml
>
> Nick Stolwijk-4 wrote:
> >
> > Run a clean before your compile, thus "mvn clean compile" or "mvn
> > clean install". This will clean out the target directory of each
> > project before compiling. The skipped java files is not really a maven
> > issue, it is the java compiler which detect which files are changed.
> >
> > Hth,
> >
> > Nick Stolwijk
> > ~Java Developer~
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/How-force-Maven-to-compile-each-project-module-even-if-there-are-no-changes-tp24286239p24302688.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
>
>


-- 
Baptiste <Batmat> MATHUS - http://batmat.net
Sauvez un arbre,
Mangez un castor !

Re: How force Maven to compile each project/module even if there are no changes

Posted by Nafter <Hd...@allshare.nl>.
Hi Nick, 

Thanks for your reply.

I adjusted the maven goals/options to indeed use "mvn clean instal ....".
The result of this change was ok. All projects are now compiled even if
there are no changes.
However no none of the JUnit tests are being executed. 
Normally about 400 JUnit tests are being executed, but because of the clean
command nothing is being executed now.
Do you know what I need to change to make sure the Unit tests are executed
again.
See attached pom file. At line 457 the call for the JUnit tests is
described.
Thanks.

Hugo


http://www.nabble.com/file/p24302688/pom.xml pom.xml 

Nick Stolwijk-4 wrote:
> 
> Run a clean before your compile, thus "mvn clean compile" or "mvn
> clean install". This will clean out the target directory of each
> project before compiling. The skipped java files is not really a maven
> issue, it is the java compiler which detect which files are changed.
> 
> Hth,
> 
> Nick Stolwijk
> ~Java Developer~
> 
> 

-- 
View this message in context: http://www.nabble.com/How-force-Maven-to-compile-each-project-module-even-if-there-are-no-changes-tp24286239p24302688.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