It's a bug. I haven't seen a jira issue that describes this problem so can file this? There're some issues with classifiers which we're about tackle soon.
Cheers! On Fri, Aug 5, 2011 at 4:45 PM, enrico <[email protected]> wrote: > Hi all, > > It seems to me, that eclipse plugin doesn't respect the dependencies' > classifier, taking only the last declared dependency for the given > group, artifact id and version. > > In a project of mine the build.gradle file contains this dependencies > block: > > dependencies { > compile 'org.apache.httpcomponents:httpclient:4.0.1' > testCompile 'org.apache.httpcomponents:httpclient:4.0.1:tests' > } > > after gradle eclipse > > $ cat .classpath > <?xml version="1.0" encoding="UTF-8"?> > <classpath> > <classpathentry kind="output" path="bin"/> > <classpathentry kind="src" path="src/main/java"/> > <classpathentry kind="src" path="src/test/java"/> > [... httpclient deps as commons-logging etc...] > <classpathentry kind="lib" > > path="/path/to/.gradle/cache/org.apache.httpcomponents/httpclient/jars/httpclient-4.0.1-tests.jar" > exported="true"/> > </classpath> > > If I change to: > > dependencies { > compile 'org.apache.httpcomponents:httpclient:4.0.1', > 'org.apache.httpcomponents:httpclient:4.0.1:tests' > testCompile 'org.apache.httpcomponents:httpclient:4.0.1', > 'org.apache.httpcomponents:httpclient:4.0.1:tests' > } > > after gradle eclipse the.classpath file contains only the entry for > 'org.apache.httpcomponents:httpclient:4.0.1:tests' (and its > dependencies): > > $ cat .classpath > <?xml version="1.0" encoding="UTF-8"?> > <classpath> > <classpathentry kind="output" path="bin"/> > <classpathentry kind="src" path="src/main/java"/> > <classpathentry kind="src" path="src/test/java"/> > [... httpclient deps as commons-logging etc...] > <classpathentry kind="lib" > > path="/path/to/.gradle/cache/org.apache.httpcomponents/httpclient/jars/httpclient-4.0.1-tests.jar" > exported="true"/> > </classpath> > > if I change the order > > dependencies { > compile 'org.apache.httpcomponents:httpclient:4.0.1:tests', > 'org.apache.httpcomponents:httpclient:4.0.1' > testCompile 'org.apache.httpcomponents:httpclient:4.0.1:tests', > 'org.apache.httpcomponents:httpclient:4.0.1' > } > > .classpath contains only the entry for > 'org.apache.httpcomponents:httpclient:4.0.1' > > <?xml version="1.0" encoding="UTF-8"?> > <classpath> > <classpathentry kind="output" path="bin"/> > <classpathentry kind="src" path="src/main/java"/> > <classpathentry kind="src" path="src/test/java"/> > [...] > <classpathentry kind="lib" > > path="/path/to/.gradle/cache/org.apache.httpcomponents/httpclient/jars/httpclient-4.0.1.jar" > exported="true"/> > </classpath> > > A workaround is to use the @jar notation but this way you have to > specify "transitive=true" to have httpclient dependencies entries. > > dependencies { > compile 'org.apache.httpcomponents:httpclient:4.0.1@jar' > testCompile 'org.apache.httpcomponents:httpclient:4.0.1:tests@jar' > } > > after gradle eclipse (note no httpclient dependency has entry): > > $ cat .classpath > <?xml version="1.0" encoding="UTF-8"?> > <classpath> > <classpathentry kind="output" path="bin"/> > <classpathentry kind="src" path="src/main/java"/> > <classpathentry kind="src" path="src/test/java"/> > <classpathentry kind="con" > path="org.eclipse.jdt.launching.JRE_CONTAINER" exported="true"/> > <classpathentry kind="lib" > > path="/path/to/.gradle/cache/org.apache.httpcomponents/httpclient/jars/httpclient-4.0.1-tests.jar" > exported="true"/> > <classpathentry kind="lib" > > path="/path/to/.gradle/cache/org.apache.httpcomponents/httpclient/jars/httpclient-4.0.1.jar" > exported="true"/> > </classpath> > > I've the expected result using: > > dependencies { > compile ('org.apache.httpcomponents:httpclient:4.0.1@jar') { > transitive = true > } > testCompile 'org.apache.httpcomponents:httpclient:4.0.1:tests@jar' > } > > $ cat .classpath > <?xml version="1.0" encoding="UTF-8"?> > <classpath> > <classpathentry kind="output" path="bin"/> > <classpathentry kind="src" path="src/main/java"/> > <classpathentry kind="src" path="src/test/java"/> > <classpathentry kind="con" > path="org.eclipse.jdt.launching.JRE_CONTAINER" exported="true"/> > <classpathentry kind="lib" > > path="/path/to/.gradle/cache/commons-codec/commons-codec/jars/commons-codec-1.3.jar" > exported="true"/> > <classpathentry kind="lib" > > path="/path/to/.gradle/cache/org.apache.httpcomponents/httpcore/jars/httpcore-4.0.1.jar" > exported="true"/> > <classpathentry kind="lib" > > path="/path/to/.gradle/cache/commons-logging/commons-logging/jars/commons-logging-1.1.1.jar" > exported="true"/> > <classpathentry kind="lib" > > path="/path/to/.gradle/cache/org.apache.httpcomponents/httpclient/jars/httpclient-4.0.1-tests.jar" > exported="true"/> > <classpathentry kind="lib" > > path="/path/to/.gradle/cache/org.apache.httpcomponents/httpclient/jars/httpclient-4.0.1.jar" > exported="true"/> > </classpath> > > Is this behaviour correct and am I missing something obvious? > > Thanks, > Enrico > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > -- Szczepan Faber Principal engineer@gradleware Lead@mockito
