You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by is...@mpsa.com on 2007/07/30 17:10:07 UTC

[maven-dependency-plugin] v 2.0-alpha-4 : include/exclude scopes

Hello !

I'd like to talk about the behaviour of the dependency:copy-depedencies
plugin, when I add some include/exclude scopes parameters.
I noticed that these parameters' types were just Strings, which means you
can set only one include scope and one exclude scope in the config tag.

After a few tests, I could establish a link between the parameter value and
the dependencies selected. The array below describes these links :

-------------------------------------------------------
param value -> dependencies scope
-------------------------------------------------------
compile -> compile + provided
runtime -> compile + runtime
provided -> provided
test -> compile + provided + runtime + test
-------------------------------------------------------

Fortunately, I need to get only compile and runtime, which corresponds to a
"runtime" value in the includeScope parameter.

But imagine you need "compile + provided + runtime", which is an equivalent
of "all but test".
How can you configure the plugin to do that ?
If I set excludeScope to "test", the build fails because I've excluded *
all * the dependencies.
If I set 2 include scopes (compile and runtime), it only takes the last
one, and doesn't work much better...

Perhaps you could change the mojo's parameters to give the user more
possibilities ?

Thanks !

Isabelle Guimiot


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


RE: [maven-dependency-plugin] v 2.0-alpha-4 : include/exclude scopes

Posted by "Brian E. Fox" <br...@reply.infinity.nu>.
Clara,
The dependency plugin uses the core scope filter to decide if something
is included in a scope. This is not the same as filtering on the
declared scope of a dependency, rather the effective scope. Everything
is needed for the test scope, so if I ask the filter "Is this in the
test scope?" the answer is always yes. The net effect of this is that
you would exclude everything, which is why it throws that exception to
tell you that you have misconfigured. 

There easiest solution is to make include scope a comma separated list
so you can specify the ones to include so you could do compile,runtime.
This would need to be added in the next version.

In the meantime you could use the artifact or groupid filters to exclude
the items you don't want. These do currently support a comma separated
list.

--Brian

-----Original Message-----
From: clarako [mailto:clara.ko@javapulse.net] 
Sent: Tuesday, September 18, 2007 4:56 AM
To: users@maven.apache.org
Subject: Re: [maven-dependency-plugin] v 2.0-alpha-4 : include/exclude
scopes


Wayne,

I'm using Maven for a commercial project and I'm making a release build.
I believe our test dependencies should be excluded from the release
build,
since the customer will/should never run the tests. So this is why I
would
need the "all but test" scope.

In the source of the maven-dependency-plugin, I saw that you cannot
exclude
the test scope, as ScopeArtifactFilter does not support it.
When I tried to work around it, I got a stack trace with the given pom.
(please see link).

http://www.nabble.com/file/p12752781/stack_trace.txt stack_trace.txt 
Regards,
Clara



Wayne Fay wrote:
> 
> I don't believe "all but test" as a possible scope makes much sense
> when you're thinking about valid use/business cases. Can you think of
> such a real-life situation?
> 
> Also, it might be helpful to review the Maven Dependency Scope section
> on this page:
>
http://maven.apache.org/guides/introduction/introduction-to-dependency-m
echanism.html
> 
> Wayne
> 
> On 7/30/07, isabelle.guimiot@mpsa.com <is...@mpsa.com>
wrote:
>>
>> Hello !
>>
>> I'd like to talk about the behaviour of the
dependency:copy-depedencies
>> plugin, when I add some include/exclude scopes parameters.
>> I noticed that these parameters' types were just Strings, which means
you
>> can set only one include scope and one exclude scope in the config
tag.
>>
>> After a few tests, I could establish a link between the parameter
value
>> and
>> the dependencies selected. The array below describes these links :
>>
>> -------------------------------------------------------
>> param value -> dependencies scope
>> -------------------------------------------------------
>> compile -> compile + provided
>> runtime -> compile + runtime
>> provided -> provided
>> test -> compile + provided + runtime + test
>> -------------------------------------------------------
>>
>> Fortunately, I need to get only compile and runtime, which
corresponds to
>> a
>> "runtime" value in the includeScope parameter.
>>
>> But imagine you need "compile + provided + runtime", which is an
>> equivalent
>> of "all but test".
>> How can you configure the plugin to do that ?
>> If I set excludeScope to "test", the build fails because I've
excluded *
>> all * the dependencies.
>> If I set 2 include scopes (compile and runtime), it only takes the
last
>> one, and doesn't work much better...
>>
>> Perhaps you could change the mojo's parameters to give the user more
>> possibilities ?
>>
>> Thanks !
>>
>> Isabelle Guimiot
>>
>>
>> ---------------------------------------------------------------------
>> 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
> 
> 
> 

-- 
View this message in context:
http://www.nabble.com/-maven-dependency-plugin--v-2.0-alpha-4-%3A-includ
e-exclude-scopes-tf4177712s177.html#a12752781
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: [maven-dependency-plugin] v 2.0-alpha-4 : include/exclude scopes

Posted by clarako <cl...@javapulse.net>.
Wayne,

I'm using Maven for a commercial project and I'm making a release build.
I believe our test dependencies should be excluded from the release build,
since the customer will/should never run the tests. So this is why I would
need the "all but test" scope.

In the source of the maven-dependency-plugin, I saw that you cannot exclude
the test scope, as ScopeArtifactFilter does not support it.
When I tried to work around it, I got a stack trace with the given pom.
(please see link).

http://www.nabble.com/file/p12752781/stack_trace.txt stack_trace.txt 
Regards,
Clara



Wayne Fay wrote:
> 
> I don't believe "all but test" as a possible scope makes much sense
> when you're thinking about valid use/business cases. Can you think of
> such a real-life situation?
> 
> Also, it might be helpful to review the Maven Dependency Scope section
> on this page:
> http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
> 
> Wayne
> 
> On 7/30/07, isabelle.guimiot@mpsa.com <is...@mpsa.com> wrote:
>>
>> Hello !
>>
>> I'd like to talk about the behaviour of the dependency:copy-depedencies
>> plugin, when I add some include/exclude scopes parameters.
>> I noticed that these parameters' types were just Strings, which means you
>> can set only one include scope and one exclude scope in the config tag.
>>
>> After a few tests, I could establish a link between the parameter value
>> and
>> the dependencies selected. The array below describes these links :
>>
>> -------------------------------------------------------
>> param value -> dependencies scope
>> -------------------------------------------------------
>> compile -> compile + provided
>> runtime -> compile + runtime
>> provided -> provided
>> test -> compile + provided + runtime + test
>> -------------------------------------------------------
>>
>> Fortunately, I need to get only compile and runtime, which corresponds to
>> a
>> "runtime" value in the includeScope parameter.
>>
>> But imagine you need "compile + provided + runtime", which is an
>> equivalent
>> of "all but test".
>> How can you configure the plugin to do that ?
>> If I set excludeScope to "test", the build fails because I've excluded *
>> all * the dependencies.
>> If I set 2 include scopes (compile and runtime), it only takes the last
>> one, and doesn't work much better...
>>
>> Perhaps you could change the mojo's parameters to give the user more
>> possibilities ?
>>
>> Thanks !
>>
>> Isabelle Guimiot
>>
>>
>> ---------------------------------------------------------------------
>> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-maven-dependency-plugin--v-2.0-alpha-4-%3A-include-exclude-scopes-tf4177712s177.html#a12752781
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: [maven-dependency-plugin] v 2.0-alpha-4 : include/exclude scopes

Posted by Wayne Fay <wa...@gmail.com>.
I don't believe "all but test" as a possible scope makes much sense
when you're thinking about valid use/business cases. Can you think of
such a real-life situation?

Also, it might be helpful to review the Maven Dependency Scope section
on this page:
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

Wayne

On 7/30/07, isabelle.guimiot@mpsa.com <is...@mpsa.com> wrote:
>
> Hello !
>
> I'd like to talk about the behaviour of the dependency:copy-depedencies
> plugin, when I add some include/exclude scopes parameters.
> I noticed that these parameters' types were just Strings, which means you
> can set only one include scope and one exclude scope in the config tag.
>
> After a few tests, I could establish a link between the parameter value and
> the dependencies selected. The array below describes these links :
>
> -------------------------------------------------------
> param value -> dependencies scope
> -------------------------------------------------------
> compile -> compile + provided
> runtime -> compile + runtime
> provided -> provided
> test -> compile + provided + runtime + test
> -------------------------------------------------------
>
> Fortunately, I need to get only compile and runtime, which corresponds to a
> "runtime" value in the includeScope parameter.
>
> But imagine you need "compile + provided + runtime", which is an equivalent
> of "all but test".
> How can you configure the plugin to do that ?
> If I set excludeScope to "test", the build fails because I've excluded *
> all * the dependencies.
> If I set 2 include scopes (compile and runtime), it only takes the last
> one, and doesn't work much better...
>
> Perhaps you could change the mojo's parameters to give the user more
> possibilities ?
>
> Thanks !
>
> Isabelle Guimiot
>
>
> ---------------------------------------------------------------------
> 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: [maven-dependency-plugin] v 2.0-alpha-4 : include/exclude scopes

Posted by "Brian E. Fox" <br...@reply.infinity.nu>.
The dependency plugin uses the same code as core to determine the scope.
Specifically, it calls a method (going by memory here) isScope(scope).
The test scope includes everything, so if used to exclude, you would get
nothing. You can use the copy goal to name specific dependencies if you
need to, or you could use other combinations of include/exclude
groups,artifacts,types etc to get what you need.

I think it's important that the dependency plugin continue to use the
same code to determine scope so that it matches the classpath provided
for a given scope.

-----Original Message-----
From: isabelle.guimiot@mpsa.com [mailto:isabelle.guimiot@mpsa.com] 
Sent: Monday, July 30, 2007 10:10 AM
To: users@maven.apache.org
Subject: [maven-dependency-plugin] v 2.0-alpha-4 : include/exclude
scopes


Hello !

I'd like to talk about the behaviour of the dependency:copy-depedencies
plugin, when I add some include/exclude scopes parameters.
I noticed that these parameters' types were just Strings, which means
you
can set only one include scope and one exclude scope in the config tag.

After a few tests, I could establish a link between the parameter value
and
the dependencies selected. The array below describes these links :

-------------------------------------------------------
param value -> dependencies scope
-------------------------------------------------------
compile -> compile + provided
runtime -> compile + runtime
provided -> provided
test -> compile + provided + runtime + test
-------------------------------------------------------

Fortunately, I need to get only compile and runtime, which corresponds
to a
"runtime" value in the includeScope parameter.

But imagine you need "compile + provided + runtime", which is an
equivalent
of "all but test".
How can you configure the plugin to do that ?
If I set excludeScope to "test", the build fails because I've excluded *
all * the dependencies.
If I set 2 include scopes (compile and runtime), it only takes the last
one, and doesn't work much better...

Perhaps you could change the mojo's parameters to give the user more
possibilities ?

Thanks !

Isabelle Guimiot


---------------------------------------------------------------------
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