[GRADLE-2909] Project dependencies have changed since 1.4 for providedCompile project('path' : ':project', 'configuration' : 'tomcatOnly') Created: 01/Oct/13  Updated: 10/Feb/17  Resolved: 10/Feb/17

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

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


 Description   

providedCompile project('path' : ':project', 'configuration' : 'tomcatOnly')

this works for bringing in a dependent war in gradle 1.4

It no longer works in gradle 1.5+

here is configuration from the subproject

configurations {tomcatOnly
}

task tomcatCommonJar(type: Jar) {
archiveName = "sams-global-${version}.jar"
from sourceSets.main.output
include('com/sams/common/tomcat/**')
}

jar.dependsOn 'tomcatCommonJar'

artifacts {
tomcatOnly tomcatCommonJar
}

here is the root project

apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'maven'
apply plugin: 'eclipse'
apply plugin: 'application'

dependencies {
compile (project (':SAMS-COMMON'))

{ transitive = false } compile 'asm:asm:3.1' compile 'com.google.guava:guava:13.0.1' compile 'com.google.code.gson:gson:2.2.2' compile 'com.sun.jersey:jersey-bundle:1.16' compile 'com.sun.jersey.contribs.jersey-oauth:oauth-client:1.16' compile 'com.sun.jersey.contribs.jersey-oauth:oauth-signature:1.16' compile 'bmc:arapi7604_build002:7.6.04.sp2' compile 'com.codahale.metrics:metrics-core:3.0.1' compile 'com.codahale.metrics:metrics-json:3.0.1' compile 'com.codahale.metrics:metrics-servlets:3.0.1' compile 'com.fasterxml.jackson.core:jackson-databind:2.2.3' providedCompile project(path:':SAMS-COMMON', configuration: 'tomcatOnly') }

the root project has compile errors that are a result of the providedCompile statement not bringing in the dependent jar. What has changed between gradle 1.4 and 1.5+ because this works fine in 1.4?



 Comments   
Comment by Gradle Forums [ 01/Oct/13 ]

Looks good to me. Did you do a clean build after switching Gradle versions?

Comment by Gradle Forums [ 01/Oct/13 ]

I did a clean and made sure the jars were rebuilt. No difference in the behavior. I looked at the log files using debug and I can see that in 1.4 the dependent jar is brought in, but I am now using 1.8 and there is no sign of the dependent jar file. The only relevant lines I see in the 1.8 debug log is this

12:59:38.922 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder] Visiting dependency sams:ConcurrentTaskEngine:unspecified(compile) -> com.sams:SAMS-COMMON:8.6.8(dependency: com.sams#SAMS-COMMON;8.6.8

{providedCompile=[tomcatOnly]}

)
12:59:38.967 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder] Visiting configuration com.sams:SAMS-COMMON:8.6.8(tomcatOnly).

whereas in 1.4 I see

14:11:38.977 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder] Visiting dependency sams#ConcurrentTaskEngine;unspecified(compile) -> com.sams#SAMS-COMMON;8.6.8([tomcatOnly])

14:11:40.639 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder] Visiting dependency sams#ConcurrentTaskEngine;unspecified(providedRuntime) -> com.sams#SAMS-COMMON;8.6.8([tomcatOnly])

14:11:40.710 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder] Visiting configuration com.sams#SAMS-COMMON;8.6.8(tomcatOnly).

14:11:40.713 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder] Attaching com.sams#SAMS-COMMON;8.6.8(tomcatOnly) to its parents.

I can also see the dependent jar being included in 1.4 and not in the 1.8 log file.

Something has changed semantically, I'm just not able to see it. Also, this issue starts with 1.5 and is consistent through 1.8.

Comment by Peter Niederwieser [ 30/Oct/13 ]

Here is a complete example. Running gradle build succeeds with 1.5 and 1.6, but fails with 1.7, 1.8, or master.

settings.gradle:

include "foo", "bar"

foo/build.gradle:

apply plugin: 'java'

dependencies {
compile project(path:':bar', configuration: 'other')
}

bar/build.gradle:

apply plugin: "java"

configurations {
other
}

task otherJar(type: Jar) {
archiveName = "sams-global-${version}.jar" // build succeeds if this line is commented out
from sourceSets.main.output
include('bar/**')
}

jar {
include("baz/**") // build succeeds if this line is commented out
}

artifacts {
other otherJar
}

foo/src/main/java/Main.java:

public class Main {
bar.Bar bbb;
}

bar/src/main/java/bar/Bar.java:

package bar;

public class Bar {}

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:34:43 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.