You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Stevo Slavić <ss...@gmail.com> on 2012/01/17 12:02:51 UTC

Disabling resolving test scoped dependencies when tests are skipped via maven.test.skip system property

Hello Maven community,

Why does Maven (3.0.3) resolve test scoped dependencies when tests
compilation and execution is skipped via maven.test.skip system property?

I'm trying to achieve this by defining a profile with all test scope
dependencies declared in it only. Profile is activated when maven.test.skip
system property is not defined. Would be more precise if I could specify
activation to be when that property is not defined or is set to false but
that doesn't seem to be possible (no compound expressions in single
property, no multiple properties in single activation) or am I missing
something?

Kind regards,
Stevo.

Re: Disabling resolving test scoped dependencies when tests are skipped via maven.test.skip system property

Posted by Wayne Fay <wa...@gmail.com>.
> Why does Maven (3.0.3) resolve test scoped dependencies when tests
> compilation and execution is skipped via maven.test.skip system property?

The maven.test.skip system property is apparently not utilized by the
plugin(s) responsible for resolving dependencies early in the build.
Whether or not you regard this as a bug would depend on your
interpretation of things, I suppose.

> system property is not defined. Would be more precise if I could specify
> activation to be when that property is not defined or is set to false but
> that doesn't seem to be possible (no compound expressions in single

You may need to brush up on profile activation, specifically the bang
expression, here in section 5.3.2:
http://www.sonatype.com/books/mvnref-book/reference/profiles-sect-activation.html

What are you actually trying to achieve, and for what purpose?

Wayne

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


Re: Disabling resolving test scoped dependencies when tests are skipped via maven.test.skip system property

Posted by Benson Margulies <bi...@gmail.com>.
I'd move the 'special' tests to their own project.

On Tue, Jan 17, 2012 at 11:17 AM, Stevo Slavić <ss...@gmail.com> wrote:
> OK, thanks for explaining! A module's tests are supposed to be run only by
> part of the team. For others not even test dependencies are accessible, so
> just disabling compiling and executing tests was not enough. Resolved this
> with a profile and putting dependencies of those tests there.
>
> Kind regards,
> Stevo.
>
> On Tue, Jan 17, 2012 at 5:06 PM, Olivier Lamy <ol...@apache.org> wrote:
>
>> Hello,
>>
>> 2012/1/17 Stevo Slavić <ss...@gmail.com>:
>> > Hello Maven community,
>> >
>> > Why does Maven (3.0.3) resolve test scoped dependencies when tests
>> > compilation and execution is skipped via maven.test.skip system property?
>>
>> That's something will happen with all maven 2.x or 3.x versions.
>> Why because maven use something generic which is kind of plugin
>> "metadata" which contains the dependencies "level/scope" needed.
>> So at this stage when resolving dependencies for the plugin, maven
>> core doesn't have any idea on any skip or other plugin parameters or
>> what the plugin does.
>>
>> How does it work.
>> See source
>> http://svn.apache.org/repos/asf/maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
>>
>> You will see an annotation @requiresDependencyResolution test (this
>> the "metadata).
>> So maven core only knows he need to resolve dependencies even if the
>> mojo have a skip or a shutdownMachine :-) parameter
>>
>> >
>> > I'm trying to achieve this by defining a profile with all test scope
>> > dependencies declared in it only. Profile is activated when
>> maven.test.skip
>> > system property is not defined. Would be more precise if I could specify
>> > activation to be when that property is not defined or is set to false but
>> > that doesn't seem to be possible (no compound expressions in single
>> > property, no multiple properties in single activation) or am I missing
>> > something?
>> >
>> > Kind regards,
>> > Stevo.
>>
>>
>>
>> --
>> Olivier Lamy
>> Talend: http://coders.talend.com
>> http://twitter.com/olamy | http://linkedin.com/in/olamy
>>
>> ---------------------------------------------------------------------
>> 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: Disabling resolving test scoped dependencies when tests are skipped via maven.test.skip system property

Posted by Stevo Slavić <ss...@gmail.com>.
OK, thanks for explaining! A module's tests are supposed to be run only by
part of the team. For others not even test dependencies are accessible, so
just disabling compiling and executing tests was not enough. Resolved this
with a profile and putting dependencies of those tests there.

Kind regards,
Stevo.

On Tue, Jan 17, 2012 at 5:06 PM, Olivier Lamy <ol...@apache.org> wrote:

> Hello,
>
> 2012/1/17 Stevo Slavić <ss...@gmail.com>:
> > Hello Maven community,
> >
> > Why does Maven (3.0.3) resolve test scoped dependencies when tests
> > compilation and execution is skipped via maven.test.skip system property?
>
> That's something will happen with all maven 2.x or 3.x versions.
> Why because maven use something generic which is kind of plugin
> "metadata" which contains the dependencies "level/scope" needed.
> So at this stage when resolving dependencies for the plugin, maven
> core doesn't have any idea on any skip or other plugin parameters or
> what the plugin does.
>
> How does it work.
> See source
> http://svn.apache.org/repos/asf/maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
>
> You will see an annotation @requiresDependencyResolution test (this
> the "metadata).
> So maven core only knows he need to resolve dependencies even if the
> mojo have a skip or a shutdownMachine :-) parameter
>
> >
> > I'm trying to achieve this by defining a profile with all test scope
> > dependencies declared in it only. Profile is activated when
> maven.test.skip
> > system property is not defined. Would be more precise if I could specify
> > activation to be when that property is not defined or is set to false but
> > that doesn't seem to be possible (no compound expressions in single
> > property, no multiple properties in single activation) or am I missing
> > something?
> >
> > Kind regards,
> > Stevo.
>
>
>
> --
> Olivier Lamy
> Talend: http://coders.talend.com
> http://twitter.com/olamy | http://linkedin.com/in/olamy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Disabling resolving test scoped dependencies when tests are skipped via maven.test.skip system property

Posted by Olivier Lamy <ol...@apache.org>.
Hello,

2012/1/17 Stevo Slavić <ss...@gmail.com>:
> Hello Maven community,
>
> Why does Maven (3.0.3) resolve test scoped dependencies when tests
> compilation and execution is skipped via maven.test.skip system property?

That's something will happen with all maven 2.x or 3.x versions.
Why because maven use something generic which is kind of plugin
"metadata" which contains the dependencies "level/scope" needed.
So at this stage when resolving dependencies for the plugin, maven
core doesn't have any idea on any skip or other plugin parameters or
what the plugin does.

How does it work.
See source http://svn.apache.org/repos/asf/maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java

You will see an annotation @requiresDependencyResolution test (this
the "metadata).
So maven core only knows he need to resolve dependencies even if the
mojo have a skip or a shutdownMachine :-) parameter

>
> I'm trying to achieve this by defining a profile with all test scope
> dependencies declared in it only. Profile is activated when maven.test.skip
> system property is not defined. Would be more precise if I could specify
> activation to be when that property is not defined or is set to false but
> that doesn't seem to be possible (no compound expressions in single
> property, no multiple properties in single activation) or am I missing
> something?
>
> Kind regards,
> Stevo.



-- 
Olivier Lamy
Talend: http://coders.talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy

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