Build failing with 1.9-rc-2


(Doug Lethin) #1

I have an application build that is working fine with version 1.8, but does not work with 1.9-rc-2.

Here is the output I’m getting:

...
:services-lib:compileJava
Resource missing. [HTTP GET: http://my.nexus.repo.com/nexus/content/groups/psd/commons-lang/commons-lang/working@WTML11fd4ec1f.local/commons-lang-working@WTML11fd4ec1f.local.pom]
Resource missing. [HTTP HEAD: http://my.nexus.repo.com/nexus/content/groups/psd/commons-lang/commons-lang/working@WTML11fd4ec1f.local/commons-lang-working@WTML11fd4ec1f.local.jar]
:services-lib:compileJava (Thread[Daemon Thread 3,5,main]) completed. Took 15.941 secs.
  FAILURE: Build failed with an exception.
  * What went wrong:
Could not resolve all dependencies for configuration ':services-lib:provided'.
> Could not find commons-lang:commons-lang:working@WTML11fd4ec1f.local.
  Required by:
      com.sample.libs:services-lib:8.12.0-SNAPSHOT > com.sample.libs:bhp-auth:6.2.5.1
      com.sample.libs:services-lib:8.12.0-SNAPSHOT > com.sample.libs:bhp-commons:6.2.5.1
      com.sample.libs:services-lib:8.12.0-SNAPSHOT > com.sample.libs:bhp-auth-valve:6.2.5.1
  * Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.

When I run this in debug mode, I see http gets like the following being made:

14:35:12.957 [DEBUG] [org.gradle.api.internal.externalresource.transport.http.HttpClientHelper] Performing HTTP HEAD: http://my.nexus.repo.com/nexus/content/groups/psd/commons-lang/commons-lang/working@WTML11fd4ec1f.local/commons-lang-working@WTML11fd4ec1f.local.jar

I don’t quite understand where WTML11fd4ec1f.local/commons-lang-working@WTML11fd4ec1f.local.jar is coming from but clearly that path is not going to be in my nexus repository.

I’m not sure how to begin to troubleshoot this or try to carve this down to a simpler use case that reproduces the problem. Any help would be appreciated.


(Benjamin Muschko) #2

Thanks for reporting this issue. It seems as if the version of the dependency “commons-lang” cannot be resolved. The version you see in the console output indicates that it cannot be resolved correctly.

Would you mind providing us with the POM that defines this dependency? I assume that the version of this dependency is provided by a parent POM dependency management element. It would be great if you could post that relevant piece of the parent POM as well (including properties if used).

Thanks again for your help.


(Doug Lethin) #3

Thanks for the response. It gave me enough info to try to isolate a simple reproducible use case.

Here is my build.gradle:

apply plugin: "java"
  repositories {
  mavenLocal()
}
  dependencies {
  compile "com.dougy.sample:shared-lib:2.0"
}
task copyToLib(type: Copy) {
    into "$buildDir/output/lib"
    from configurations.runtime
}

Here’s my pom for shared-lib:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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>
      <parent>
      <groupId>com.dougy.sample</groupId>
      <artifactId>top-level</artifactId>
      <version>2.0</version>
    </parent>
      <artifactId>shared-lib</artifactId>
      <dependencies>
          <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
          </dependency>
    </dependencies>
  </project>

Share lib pom refers to a parent pom which is here:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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>com.dougy.sample</groupId>
    <artifactId>top-level</artifactId>
    <version>2.0</version>
    <packaging>pom</packaging>
      <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>commons-lang</groupId>
                <artifactId>commons-lang</artifactId>
                <version>2.3</version>
                <type>jar</type>
                <scope>compile</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
</project>

I publshed these poms to my maven repo and then ran the build.

It works fine in gradle 1.8, but in gradle 1.9-rc-2, I get the following output:

[WTML11fd4ec1f:gradle/bugs/prob1] dlethin% ~/tools/gradle/gradle-1.9-rc-2/bin/gradle clean copyToLib
:clean UP-TO-DATE
:copyToLib
  FAILURE: Build failed with an exception.
  * What went wrong:
Could not resolve all dependencies for configuration ':runtime'.
> Could not find commons-lang:commons-lang:working@WTML11fd4ec1f.local.
  Required by:
      :prob1:unspecified > com.dougy.sample:shared-lib:2.0
  * Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
  BUILD FAILED
  Total time: 0.804 secs

Seems 1.9-rc-2 is having some trouble dealing with poms where the version is specified in a parent’s dependencyManagement section.

Thanks for looking into this. Let me know if you need any additional info.


(Benjamin Muschko) #4

Great, thanks. It think this is the same issue as GRADLE-2938.


(Doug Lethin) #5

Yes, I agree with that. Same build output and use case.

Thanks.


(Benjamin Muschko) #6

Thank you for taking the time to provide the information. That’s always very helpful.


(Benjamin Muschko) #7

Would you mind trying out your project with a 1.9 snapshot distribution containing a fix for this issue? Thank you so much for your help.


(Doug Lethin) #8

I gave it a try but it appears I get the same error. here’s a snip of some debug logging:

14:05:55.106 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Sending request: GET /nexus/content/groups/psd/commons-lang/commons-lang/working@WTML11fd4ec1f.local/commons-lang-working@WTML11fd4ec1f.local.pom HTTP/1.1
14:05:55.106 [DEBUG] [org.apache.http.headers] >> GET /nexus/content/groups/psd/commons-lang/commons-lang/working@WTML11fd4ec1f.local/commons-lang-working@WTML11fd4ec1f.local.pom HTTP/1.1
14:05:55.107 [DEBUG] [org.apache.http.headers] >> Accept-Encoding: gzip,deflate
14:05:55.107 [DEBUG] [org.apache.http.headers] >> Host: nexus.payments.intuit.com
14:05:55.107 [DEBUG] [org.apache.http.headers] >> Connection: Keep-Alive
14:05:55.108 [DEBUG] [org.apache.http.headers] >> User-Agent: Gradle/1.9-20131029130122+0000 (Mac OS X;10.8.5;x86_64) (Apple Inc.;1.6.0_65;20.65-b04-462)
14:06:03.085 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Receiving response: HTTP/1.1 404 Not Found

Thanks.


(Benjamin Muschko) #9

Sorry, I forgot to mention that you will have to first delete your cache under ~/.gradle/caches/modules-2.


(Doug Lethin) #10

Ah. OK, with my cache deleted, my build worked. Though it took 37 minutes to re-download all my dependencies. The 2nd time after that I ran a clean build and it took 30 seconds)

Thanks for fixing this.


(Benjamin Muschko) #11

Great, thanks for taking the time to verify the fix.