A runtime dependency is missing from the generated pom file


(Maury Hammel) #1

I’m new to gradle and pom files, etc. so please be gentle. :slight_smile:

I’ve inherited a couple of build.gradle files that contains the following dependency entries with the same item listed as both a compile-time and a run-time dependency. However, the run-time dependency does not show up in the generated pom file:

Example #1:

dependencies {
  compile gradleApi()
  groovy localGroovy()
    testCompile group: 'junit', name: 'junit', version: '4.8.2'
  testCompile group: 'xom', name: 'xom', version: '1.2.5'
  testCompile group: 'com.oracle', name: 'ojdbc6', version: '11.2.0.2'
    compile group: 'org.codehaus.groovy.modules.http-builder', name: 'http-builder', version: '0.5.2'
    runtime group: 'org.codehaus.groovy.modules.http-builder', name: 'http-builder', version: '0.5.2'
  runtime group: 'com.oracle', name: 'ojdbc6', version: '11.2.0.2'
  runtime group: 'xom', name: 'xom', version: '1.2.5'
}

Example #2:

dependencies {
  compile gradleApi()
  groovy localGroovy()
    compile group: 'com.cfactor.release', name: 'groovy-release-utilities', version: '1.1'
    runtime group: 'com.cfactor.release', name: 'groovy-release-utilities', version: '1.1'
}

The generated pom files contain the following (generated using gradle 1.0-rc-1):

Example #1:

<dependencies>
  <dependency>
    <groupId>xom</groupId>
    <artifactId>xom</artifactId>
    <version>1.2.5</version>
    <scope>runtime</scope>
  </dependency>
  <dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.8.2</version>
    <scope>test</scope>
  </dependency>
  <dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc6</artifactId>
    <version>11.2.0.2</version>
    <scope>runtime</scope>
  </dependency>
  <dependency>
    <groupId>org.codehaus.groovy.modules.http-builder</groupId>
    <artifactId>http-builder</artifactId>
    <version>0.5.2</version>
    <scope>compile</scope>
  </dependency>
</dependencies>

Example #2:

<dependencies>
  <dependency>
    <groupId>com.cfactor.release</groupId>
    <artifactId>groovy-release-utilities</artifactId>
    <version>1.1</version>
    <scope>compile</scope>
  </dependency>
</dependencies>

Shouldn’t there be an entry for org.codehaus.groovy.modules.http-builder/http-builder with a scope of runtime in the first example, and the same for com.cfactor.release/groovy-release-utilities in the second example?

I’m not sure if this is a case of a problem in gradle or if it’s just my lack of understanding the structure of the pom. Any help would be appreciated.

Thanks, Maury


(Peter Niederwieser) #2

Both in Gradle and Maven, ‘compile’ implies ‘runtime’. Hence the generated POMs are correct.