---- Rohnny Moland <[EMAIL PROTECTED]> schrieb:
> Hello,
> 
> I was reading this:
> 
> <http://maven.apache.org/guides/mini/guide-attached-tests.html>.
> 
> It works fine if I build my project and run the tests, but what if I
> want to just build my project and skip the tests? I get a dependency
> resolution error then, because my test dependency cannot be found.
> 
> I know 2 possible solutions:
> 1) Create a profile and include my test dependency in it. This is
> misuse of a profile in my opinion.
> 2) Deploy the test dependency in a local repository and only depend on
> it as a binary.
> 
> I dont really understand why the reactor does not ignore dependencies
> with scope=test, when you run maven with the skip test option set to
> true. Isnt this how it should be?

No, it's working as designed.

Tests can take a long time to run, so it's useful to sometimes skip that. But 
compiling them is not normally something that people want to skip; checking in 
code that breaks the compilation of tests should almost always be a build 
failure.

If you read the surefire documentation, it explicitly says that *running* of 
the tests is skipped, not compiling.

And anyway, the surefire plugin has the responsibility for running the tests, 
but it is the maven-compiler-plugin that has the responsibility for compiling 
them.

You can disable compilation of tests by excluding classes in the 
maven-compiler-plugin configuration, but I don't think that will block 
downloading of test dependencies. 

In your case, putting the test dependencies in a separate profile would seem to 
be the appropriate solution. It doesn't seem like an abuse of profiles to me; 
you have two alternative configurations one of which has some dependencies that 
the other does not. That seems a quite reasonable use of a profile.

Regards,
Simon


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

Reply via email to