[GRADLE-2796] Gradle does not include transitive required compile dependency Created: 20/Jun/13  Updated: 10/Feb/17  Resolved: 10/Feb/17

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Gradle Forums Assignee: Unassigned
Resolution: Won't Fix Votes: 1


 Description   

I'm using Gradle 1.6. Here is the project that I have:

apply plugin: 'groovy'
repositories

{ mavenCentral() }

dependencies

{ compile 'org.apache.activemq:activemq-core:5.4.0' }

org.apache.activemq:activemq-core:5.4.0 has a compile dependency on activeio-core ([1]http://search.maven.org/remotecontent...):

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>activeio-core</artifactId>
<optional>false</optional>
</dependency>

The dependency is actually defined in here: [2]http://search.maven.org/remotecontent....

Gradle doesn't resolve the dependency:

$ ./gradlew dependencyInsight --dependency activeio-core
:dependencyInsight
No dependencies matching given input were found in configuration ':compile'

$ ./gradlew dependencies --configuration compile
:dependencies
------------------------------------------------------------
Root project
------------------------------------------------------------
compile - Compile classpath for source set 'main'.
--- org.apache.activemq:activemq-core:5.4.0
+--- commons-logging:commons-logging-api:1.1
+--- org.apache.geronimo.specs:geronimo-jms_1.1_spec:1.1.1
+--- org.apache.activemq:kahadb:5.4.0

--- commons-logging:commons-logging:1.1 -> 1.1.1
+--- org.apache.activemq.protobuf:activemq-protobuf:1.1
+--- org.osgi:org.osgi.core:4.1.0
+--- org.apache.geronimo.specs:geronimo-j2ee-management_1.1_spec:1.0.1
+--- org.springframework:spring-context:3.0.3.RELEASE
+--- org.springframework:spring-aop:3.0.3.RELEASE
  +--- aopalliance:aopalliance:1.0
  +--- org.springframework:spring-asm:3.0.3.RELEASE
  +--- org.springframework:spring-beans:3.0.3.RELEASE
    --- org.springframework:spring-core:3.0.3.RELEASE
    +--- org.springframework:spring-asm:3.0.3.RELEASE
    --- commons-logging:commons-logging:1.1.1
  --- org.springframework:spring-core:3.0.3.RELEASE
+--- org.springframework:spring-beans:3.0.3.RELEASE
+--- org.springframework:spring-core:3.0.3.RELEASE
+--- org.springframework:spring-expression:3.0.3.RELEASE
  --- org.springframework:spring-core:3.0.3.RELEASE
--- org.springframework:spring-asm:3.0.3.RELEASE
--- commons-net:commons-net:2.0

$ ./gradlew dependencies | grep -i activeio-core
$ echo $?
1

(The last two lines just show that grepping all dependencies for activeio-core finds nothing.)

Can it be that Gradle gets confused with the second dependency:

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>activeio-core</artifactId>
<optional>false</optional>
<type>test-jar</type>
</dependency>

Analogous maven project:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.test</groupId>
<artifactId>maven-deps</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>5.4.0</version>
</dependency>
</dependencies>
</project>

produces this:

$ mvn dependency:tree -Dverbose
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building maven-deps 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] — maven-dependency-plugin:2.1:tree (default-cli) @ maven-deps —
[INFO] de.test:maven-deps:jar:1.0-SNAPSHOT
[INFO] - org.apache.activemq:activemq-core:jar:5.4.0:compile
[INFO] +- commons-logging:commons-logging-api:jar:1.1:compile
[INFO] +- org.apache.geronimo.specs:geronimo-jms_1.1_spec:jar:1.1.1:compile
[INFO] +- org.apache.activemq:activeio-core:jar:3.1.2:compile
[INFO] | +- (org.apache.geronimo.specs:geronimo-j2ee-management_1.1_spec:jar:1.0.1:compile - omitted for duplicate)
[INFO] | - commons-logging:commons-logging:jar:1.1:compile
[INFO] | +- log4j:log4j:jar:1.2.12:compile
[INFO] | +- logkit:logkit:jar:1.0.1:compile
[INFO] | +- avalon-framework:avalon-framework:jar:4.1.3:compile
[INFO] | - javax.servlet:servlet-api:jar:2.3:compile
[INFO] +- org.apache.activemq:kahadb:jar:5.4.0:compile
[INFO] | - (commons-logging:commons-logging:jar:1.1:compile - omitted for duplicate)
[INFO] +- org.apache.activemq.protobuf:activemq-protobuf:jar:1.1:compile
[INFO] +- org.osgi:org.osgi.core:jar:4.1.0:compile
[INFO] +- org.apache.geronimo.specs:geronimo-j2ee-management_1.1_spec:jar:1.0.1:compile
[INFO] +- org.springframework:spring-context:jar:3.0.3.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:3.0.3.RELEASE:compile
[INFO] | | +- aopalliance:aopalliance:jar:1.0:compile
[INFO] | | +- (org.springframework:spring-asm:jar:3.0.3.RELEASE:compile - omitted for duplicate)
[INFO] | | +- (org.springframework:spring-beans:jar:3.0.3.RELEASE:compile - omitted for duplicate)
[INFO] | | - (org.springframework:spring-core:jar:3.0.3.RELEASE:compile - omitted for duplicate)
[INFO] | +- org.springframework:spring-beans:jar:3.0.3.RELEASE:compile
[INFO] | | - (org.springframework:spring-core:jar:3.0.3.RELEASE:compile - omitted for duplicate)
[INFO] | +- org.springframework:spring-core:jar:3.0.3.RELEASE:compile
[INFO] | | +- (org.springframework:spring-asm:jar:3.0.3.RELEASE:compile - omitted for duplicate)
[INFO] | | - (commons-logging:commons-logging:jar:1.1.1:compile - omitted for conflict with 1.1)
[INFO] | +- org.springframework:spring-expression:jar:3.0.3.RELEASE:compile
[INFO] | | - (org.springframework:spring-core:jar:3.0.3.RELEASE:compile - omitted for duplicate)
[INFO] | - org.springframework:spring-asm:jar:3.0.3.RELEASE:compile
[INFO] - commons-net:commons-net:jar:2.0:compile

As you can see, the org.apache.activemq:activeio-core:jar:3.1.2:compile dependency is there.
It is not only a problem of the dependency plugin, as my originla issue comes from a webapp, and WEB-INF/lib by Gradle doesn't contain the lib, and maven's does.

wujek
----------------------------------------------------------------------------------------
[1] http://search.maven.org/remotecontent?filepath=org/apache/activemq/activemq-core/5.4.0/activemq-core-5.4.0.pom
[2] http://search.maven.org/remotecontent?filepath=org/apache/activemq/activemq-parent/5.4.0/activemq-parent-5.4.0.pom



 Comments   
Comment by Gradle Forums [ 20/Jun/13 ]

A very similar problem occurs with the following:

apply plugin: 'groovy'
repositories

{ mavenCentral() }

dependencies

{ compile 'org.apache.myfaces.core:myfaces-impl:2.1.9' }

org.apache.myfaces:myfaces-impl:2.1.9 has a compile dependency on myfaces-api ([1]http://search.maven.org/remotecontent...):

<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
</dependency>

The dependency is actually defined in here: [2]http://search.maven.org/remotecontent....

Gradle doesn't resolve the dependency:

$ ./gradlew dependencyInsight --dependency myfaces-api
:dependencyInsight
No dependencies matching given input were found in configuration ':compile'

$ ./gradlew dependencies --configuration compile
:dependencies
------------------------------------------------------------
Root project
------------------------------------------------------------
compile - Compile classpath for source set 'main'.
--- org.apache.myfaces.core:myfaces-impl:2.1.9
+--- commons-collections:commons-collections:3.2
+--- commons-codec:commons-codec:1.3
+--- commons-beanutils:commons-beanutils:1.8.3

--- commons-logging:commons-logging:1.1.1
--- commons-digester:commons-digester:1.8
+--- commons-beanutils:commons-beanutils:1.7.0 -> 1.8.3
--- commons-logging:commons-logging:1.1 -> 1.1.1

$ ./gradlew dependencies | grep -i myfaces-api
$ echo $?
1

(The last two lines just show that grepping all dependencies for activeio-core finds nothing.)

An similar situation as before, there is another dependency (also in the parent):

<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>

Analogous maven project:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.test</groupId>
<artifactId>maven-deps</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
<version>2.1.9</version>
</dependency>
</dependencies>
</project>

produces this:

$ mvn dependency:tree -Dverbose
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building maven-deps 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] — maven-dependency-plugin:2.1:tree (default-cli) @ maven-deps —
[INFO] de.test:maven-deps:jar:1.0-SNAPSHOT
[INFO] - org.apache.myfaces.core:myfaces-impl:jar:2.1.9:compile
[INFO] +- org.apache.myfaces.core:myfaces-api:jar:2.1.9:compile
[INFO] +- commons-collections:commons-collections:jar:3.2:compile
[INFO] +- commons-codec:commons-codec:jar:1.3:compile
[INFO] +- commons-beanutils:commons-beanutils:jar:1.8.3:compile
[INFO] | - commons-logging:commons-logging:jar:1.1.1:compile
[INFO] - commons-digester:commons-digester:jar:1.8:compile
[INFO] +- (commons-beanutils:commons-beanutils:jar:1.7.0:compile - omitted for conflict with 1.8.3)
[INFO] - (commons-logging:commons-logging:jar:1.1:compile - omitted for conflict with 1.1.1)

As you can see, the myfaces-api dependency is in the list.

wujek
----------------------------------------------------------------------------------------
[1] http://search.maven.org/remotecontent?filepath=org/apache/myfaces/core/myfaces-impl/2.1.9/myfaces-impl-2.1.9.pom
[2] http://search.maven.org/remotecontent?filepath=org/apache/myfaces/core/myfaces-core-project/2.1.9/myfaces-core-project-2.1.9.pom

Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Benjamin Muschko [ 10/Feb/17 ]

Thanks again for reporting this issue. We haven't heard back from you after our inquiry from November 15th. We are closing this issue now. Please create an issue on GitHub if you still feel passionate about getting it resolved.

Generated at Wed Jun 30 12:31:45 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.