|
Hello,
I need to have the same dependency with two different scopes : test and provided. 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 ? |
|
On 18 October 2011 11:20, mickael leduque
<[hidden email]> 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: [hidden email] For additional commands, e-mail: [hidden email] |
|
In reply to this post by mickael leduque
Simply use only provided scope as it will be available to your tests as
well. On Oct 18, 2011 6:28 AM, "mickael leduque" <[hidden email]> wrote: > Hello, > > I need to have the same dependency with two different scopes : test and > provided. > 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 ? > |
| Powered by Nabble | Edit this page |
