Hi Benoit,

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: mercredi 30 août 2006 16:25
> To: users@maven.apache.org
> Subject: [M2] My tests are launched 3 times !
> 
> Hi all,
> 
> I run a 'mvn clean site install' and my tests are launched 3 times :

If you run "mvn test:test test:test test:test test:test" your tests will be
executed 4 times :-) "Site" and "Install" are different lifecycles so by
running both you're explicitely asking maven to run the tests several times.

Maven cannot really guess by itself if the tests have to be re-executed or
not. Take for example the Clover plugin. It MUST re-execute the tests
because it executes them on clovered sources and not on the original
sources. If Maven were to execute the tests only once the clover plugin
would report 0% coverage.

However it should be possible (but that's a core change) for Maven to know
if a plugin goal has already been called within a lifecycle and decide not
to re-execute it. That said for it to work it would need the help from
plugins who would need to tell Maven whether it should still force the
executions. But then the pb is that the plugins do NOT know what goals are
executed. They only know about phases. So they would need to say wether
plugins bound to such phase should be re-executed or not. All this is
relatively messy and I'm pretty sure we'd discover some edge cases...

Another related use case is to know whether the tests should be run twice if
I run "mvn test" twice. We could have the surefire plugin by default verify
that the test results are newer than any of the source and configuration
files and decide not to run the tests again. Of course there would need to
be a flag to tell it always rerun the tests.

All these ideas can improve fine-tuning of tests but they're going to be
compensated by the additional complexity they bring. Users would need to
perfectly understand lifecycles and goals bound to them which is probably
going to cause some troubles and questions on the mailing list... ;-)

All in all, I'd love tests to be executed only once but I have no idea how
to make it work from all angles.
 
> On for the surefire report plugin, one for the cobertura plugin and one
> for the
> install plugin.

Although I don't know the cobertura plugin this sounds normal. The clover
plugin will also do this. See above.
 
> How can i do to have them launched only once ?

Only tell Maven to run them once. For example: remove the cobertura plugin
usage and run "mvn install". They'll run only once ;-) ahahaha....

-Vincent



 p2.vert.ukl.yahoo.com uncompressed Thu Aug 31 08:27:00 GMT 2006


___________________________________________________________________________
Découvrez un nouveau moyen de poser toutes vos questions quelque soit le sujet !
Yahoo! Questions/Réponses pour partager vos connaissances, vos opinions et vos 
expériences.
http://fr.answers.yahoo.com



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to