providedCompile incorrectly excludes transitive dependencies from a WAR that are also compile dependencies of a project


(bmcfeely) #1

In Gradle 1.0-milestone-6 (also saw it in milestone-3), providedCompile seems to be incorrectly stripping transitive dependencies that are also compile dependencies of a project.

Running “gradlew clean war” with the following build.gradle results in a WAR whose WEB-INF\lib only contains logback-core-0.9.24.jar. It is missing slf4j-api-1.6.1.jar.

When I change shiro-core from providedCompile to compile, then slf4j-api-1.6.1.jar (and of course the shiro-core jar) show up in the WAR.

I think that transitive dependecies of providedCompile dependencies should only be stripped from the WAR if they are not explicit dependencies elsewhere. I think, at least :slight_smile:

Thanks for all the good work!

apply plugin: 'war'
  repositories {
    mavenCentral()
}
  dependencies {
  providedCompile 'org.apache.shiro:shiro-core:1.1.0'
      compile 'org.slf4j:slf4j-api:1.6.1'
             // A transitive dependency of shiro-core as well
  compile 'ch.qos.logback:logback-core:0.9.24'
   // Not a transitive dependency of shiro-core
}
  task wrapper(type: org.gradle.api.tasks.wrapper.Wrapper) {
  gradleVersion = '1.0-milestone-6'
  jarFile = '.wrapper/gradle-wrapper.jar'
  description = 'Builds the gradlew wrapper'
}

(Szczepan Faber) #2

Yeah I agree. Did you look at jira if we already have such issue reported?


(bmcfeely) #3

Sorry, I didn’t. I’m a noob here, how do I do that?


(Szczepan Faber) #4

Here’s the link: http://issues.gradle.org


(bmcfeely) #5

Thanks. So it looks like there’s a related question having to do with multi-project builds at http://issues.gradle.org/browse/GRADLE-510, but this issue here can be reproduced with a single project. I didn’t find anything mentioning that at http://issues.gradle.org.