[GRADLE-461] Transitive dependencies not working for the Scala plugin (works in maven) Created: 24/Apr/09  Updated: 04/Jan/13  Resolved: 24/Nov/10

Status: Resolved
Project: Gradle
Affects Version/s: 0.5.2
Fix Version/s: 0.9-rc-1

Type: Bug
Reporter: Jeppe Nejsum Madsen Assignee: Hans Dockter
Resolution: Fixed Votes: 0

Attachments: Zip Archive helloworld.zip    

 Description   

Note: Need Gradle with the Scala plugin: http://jira.codehaus.org/browse/GRADLE-287

Running "gradle test" for the attached project yields the following compilation error:
$ gradle test
:init
:resources
:defineScalaAnt
:compile
:testResources
:testCompile
error: error while loading Server, class file 'C:\Users\jnm\.gradle\cache\org.mortbay.jetty\jetty\jars\jetty-6.1.
6.jar(org/mortbay/jetty/Server.class)' is broken
(class org.mortbay.util.Attributes not found.)

The reason is due to missing dependency 'org.mortbay.jetty:jetty-util:6.1.6'. The Attributes class is not referenced directly from the project, only indirectly from the Server class. So I think it shouldn't be necessary to declare this dependency. The jetty pom (http://repo2.maven.org/maven2/org/mortbay/jetty/jetty/6.1.6/jetty-6.1.6.pom) contains this

<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>${project.version}</version>
</dependency>

Running "mvn test" works fine and doesn't not specify this jar in the pom.

I'm unsure whether this is a problem with the Scala gradle plugin or Gradle itself



 Comments   
Comment by Hans Dockter [ 31/Aug/09 ]

I think this points to a more fundamental issue we should analyze for 0.9.

Comment by Hans Dockter [ 12/Nov/09 ]

Is this still an issue for you?

The compile configuration resolves non-transitive by design (one can change this easily). There are issues with Groovy that the transitive dependencies must be available to compile. Which means that for Groovy this might cause trouble. In general we plan to make the compile configuration resolve transitively and provide a code quality check instead, which ensures that classes from transitive dependencies are not directly accessed in the code.

I would like to rename this issue for this purpose and transform it from BUG to IMPROVEMENT. Is this OK?

Comment by Jeppe Nejsum Madsen [ 12/Nov/09 ]

The issue still exists in Gradle 0.8, but it is not a showstopper since I can just specify the deps manually.

Renaming and transforming is fine with me.

Comment by Hans Dockter [ 16/Nov/09 ]

Then it should remain a bug. I still need to understand why exactly you need an indirect dependency here to compile code.

Comment by Hans Dockter [ 22/Apr/10 ]

The compile configuration is now resolved transitively by default.

Generated at Wed Jun 30 11:30:41 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.