On 18 October 2011 11:20, mickael leduque
<mickael.leduque.se...@gmail.com> wrote:
> Hello,
>
> I need to have the same dependency with two different scopes : test and
> provided.

http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope

> provided
> This is much like compile, but indicates you expect the JDK or a container to 
> provide the dependency at runtime. For example, when building a web 
> application for the Java Enterprise Edition, you would set the dependency on 
> the Servlet API and related Java EE APIs to scope provided because the web 
> container provides those classes. This scope is only available on the 
> compilation and test classpath, and is not transitive.

are you sure you need the two different scopes? provided will be on
the test classpath

> The scope mustn't be compile, of course.
>
> Now, if I try to repeat the dependency declaration twice with different
> scope, maven says :
>
> [WARNING] Some problems were encountered while building the effective model
> for <groupId>:<artifactid>:jar:1.0-SNAPSHOT
> [WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)'
> must be unique: <dep-groupId>:<dep-artifactId>:jar -> duplicate declaration
> of version (?) @ line 85, column 21
>
> I suppose it ignores my attempt and either
> 1. chooses randomly one of the scopes
> 2. decides to ignore either and decides it will be the default scope,
> compile
>
> How can I have what I need ?
>

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

Reply via email to