Gradle-1.4-rc-1 cannot resolve parent POM element that has a SNAPSHOT version

WIth --info, the end of the daemon log consists of 244 identical lines that look like this:

Cached resource is up-to-date (lastModified: Fri Jan 18 13:45:06 CET 2013). [HTTP: http://x.x.x.x/nexus/content/groups/public/group/1.0-SNAPSHOT/artifact-1.0-20130118.124506-255.pom]

The end of the daemon log with --debug looks like this:

23:47:53.524 [INFO] [org.gradle.api.internal.externalresource.transfer.DefaultCacheAwareExternalResourceAccessor] Cached resource is up-to-date (lastModified: Fri Jan 18 13:45:06 CET 2013). [HTTP: http://x.x.x.x/nexus/content/groups/public/group/1.0-SNAPSHOT/artifact-1.0-20130118.124506-255.pom]

23:47:53.527 [DEBUG] [org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver] Downloading http://x.x.x.x/nexus/content/groups/public/group/1.0-SNAPSHOT/artifact-1.0-20130118.124506-255.pom to /private/var/folders/7r/lwvxzqm10l716wzmh50_9_gm0000h2/T/gradle_download3449865593438265035bin

23:47:53.532 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on artifact cache (/Users/jenkins/.gradle/caches/artifacts-23).

23:47:53.534 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.

23:47:53.537 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Opening cache artifact-at-url.bin (/Users/jenkins/.gradle/caches/artifacts-23/artifact-at-url.bin)

23:47:53.539 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache artifact-at-url.bin (/Users/jenkins/.gradle/caches/artifacts-23/artifact-at-url.bin)

23:47:53.541 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on artifact cache (/Users/jenkins/.gradle/caches/artifacts-23).

23:47:53.550 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on artifact cache (/Users/jenkins/.gradle/caches/artifacts-23).

23:47:53.552 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.

23:47:53.553 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.UserResolverChain] Attempting to resolve module ‘group#artifact;1.0-SNAPSHOT’ using repositories [nexus, MavenLocal, MavenRepo, GitHub, nexus2]

23:47:53.555 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Opening cache dynamic-revisions.bin (/Users/jenkins/.gradle/caches/artifacts-23/dynamic-revisions.bin)

23:47:53.557 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Opening cache module-metadata.bin (/Users/jenkins/.gradle/caches/artifacts-23/module-metadata.bin)

23:47:53.559 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache module-metadata.bin (/Users/jenkins/.gradle/caches/artifacts-23/module-metadata.bin)

23:47:53.561 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache dynamic-revisions.bin (/Users/jenkins/.gradle/caches/artifacts-23/dynamic-revisions.bin)

23:47:53.563 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on artifact cache (/Users/jenkins/.gradle/caches/artifacts-23).

23:47:53.564 [DEBUG] [org.gradle.api.internal.externalresource.transport.http.HttpResourceAccessor] Constructing external resource: http://x.x.x.x/nexus/content/groups/public/group/1.0-SNAPSHOT/maven-metadata.xml

23:47:53.566 [DEBUG] [org.gradle.api.internal.externalresource.transport.http.HttpClientHelper] Performing HTTP GET: http://x.x.x.x/nexus/content/groups/public/group/1.0-SNAPSHOT/maven-metadata.xml

23:47:53.568 [DEBUG] [org.apache.http.impl.conn.PoolingClientConnectionManager] Connection request: [route: {}->http://x.x.x.x][total kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 20]

23:47:53.570 [DEBUG] [org.apache.http.impl.conn.PoolingClientConnectionManager] Connection leased: [id: 1096][route: {}->http://x.x.x.x][total kept alive: 0; route allocated: 1 of 2; total allocated: 1 of 20]

23:47:53.571 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnectionOperator] Connecting to x.x.x.x:80

23:47:53.574 [DEBUG] [org.apache.http.client.protocol.RequestAddCookies] CookieSpec selected: best-match

23:47:53.575 [DEBUG] [org.apache.http.client.protocol.RequestAuthCache] Auth cache not set in the context

23:47:53.577 [DEBUG] [org.apache.http.client.protocol.RequestTargetAuthentication] Target auth state: UNCHALLENGED

23:47:53.579 [DEBUG] [org.apache.http.client.protocol.RequestProxyAuthentication] Proxy auth state: UNCHALLENGED

23:47:53.580 [DEBUG] [org.apache.http.impl.client.SystemDefaultHttpClient] Attempt 1 to execute request

23:47:53.582 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Sending request: GET /nexus/content/groups/public/group/1.0-SNAPSHOT/maven-metadata.xml HTTP/1.1

23:47:53.584 [DEBUG] [org.apache.http.headers] >> GET /nexus/content/groups/public/group/1.0-SNAPSHOT/maven-metadata.xml HTTP/1.1

23:47:53.585 [DEBUG] [org.apache.http.headers] >> Accept-Encoding: gzip,deflate

23:47:53.587 [DEBUG] [org.apache.http.headers] >> Host: x.x.x.x

23:47:53.588 [DEBUG] [org.apache.http.headers] >> Connection: Keep-Alive

23:47:53.590 [DEBUG] [org.apache.http.headers] >> User-Agent: Gradle/1.4-rc-1 (Mac OS X;10.7.5;x86_64) (Apple Inc.;1.6.0_29;20.4-b02-402)

Let me know if I can do anything else to give you more/better info.

I already deleted everything in ~/.gradle with no change.

~/.gradle/gradle.properties contains

org.gradle.daemon=false

A few things you could do to help us track this down. Provide: 1. The repositories{} and dependencies{} sections of your build file 2. Log files of running Gradle with ‘–refresh-dependencies --no-daemon --debug dependencies’ 3. Log files of running Gradle with ‘–refresh-dependencies --daemon --debug dependencies’

(The actual task executed isn’t particularly important - anything that forces dependencies to be resolved).

The build works with both

–refresh-dependencies --no-daemon --debug dependencies

and

–refresh-dependencies --daemon --debug dependencies

But it fails with both

–refresh-dependencies --no-daemon --debug clean build

and

–refresh-dependencies --daemon --debug clean build

This is definitely a regression. I reverted to Gradle 1.3 and everything worked fine again. Jenkins is using ‘gradlew’ to build.

The repositories section looks like this:

def repositoryConfiguration = {

maven {

name ‘nexus’

url ‘http://x.x.x.x/nexus/content/groups/public

}

mavenLocal()

mavenCentral()

add(new org.apache.ivy.plugins.resolver.URLResolver()) { // bmuschko cargo

name = ‘GitHub’

addArtifactPattern ‘http://cloud.github.com/downloads/[organisation]/[module]/[module]-[revision].[ext]’

}

}

project.buildscript {

repositories repositoryConfiguration

}

allprojects {

repositories repositoryConfiguration

}

The dependencies section in the failing project looks like this:

def failingProject = project(‘failing.project’) {

dependencies {

compile(

managedDependency(‘org.codehaus.jackson:jackson-mapper-lgpl’),

managedDependency(‘some.internal.group:some.internal.artifact’),

referencedProject

)

}

}

‘some.internal.group:some.internal.artifact’ references an artifact that is built externally by Maven and uploaded to the nexus. ‘referencedProject’ is a local variable similar to ‘failingProject’.

‘some.internal.group:some.internal.artifact’ pom references the dependency that is resolved 244 times as parent.

The ‘managedDependency’ call is part of our own trivial dependency management.

I’m pretty sure that it is unrelated but I include it anyway:

def versions = [:]

def versionKey = { group, name -> [‘group’: group, ‘name’: name] }

project.ext.registerVersion = { key, version ->

if (key instanceof String) {

def split = key.split(’:’)

key = versionKey(split[0], split[1])

}

if (versions[key]) logger.warn("""Override version for ${key}

old: ${versions[key]}

new: ${version}

“”")

versions[key] = version // same as --> version.put(key, version)

}

project.ext.managedDependency = { String dep ->

if (thugs.contains(dep)) {

logger.warn(“You are using a thug dependency!\n${dep}”)

}

def resolved = [:]

def ext = null

if (dep.contains(’@’)) {

def split = dep.split(’@’)

dep = split[0]

ext = split[1]

}

if (dep.contains(’:’)) {

def split = dep.split(’:’)

resolved = [group: split[0], name: split[1]]

} else {

resolved = [group: dep]

}

resolved.version = versions[resolved]

if (ext) {

resolved.ext = ext

}

if (!resolved.version) {

throw new IllegalArgumentException("""

Could not find version for ${dep}.

Add Following to dependencies.gradle and replace XXX withwith the version you want to use.

registerVersion(’${resolved.group}:${resolved.name}’,XXX)

“”" as String)

}

return resolved

}

//task findVersion << {

task(group: ‘Reporting’, description: ‘Displays all registered versions containing -Pquery. (all if query is not provided)’, ‘findVersion’) << {

versions.each { key, value ->

def dep = “${key.group}:${key.name}”

def printDep = { println(“managedDependency(’${dep}’) - ${value}”) }

if (project.hasProperty(‘query’)) {

if (dep.contains(query)) {

printDep()

}

} else {

printDep()

}

}

}

task(group: ‘Reporting’, description: ‘Displays registered versions which are not used’, ‘unusedVersions’) << {

Set versionKeys = versions.keySet();

allprojects.each { project ->

project.configurations.all { configuration ->

configuration.dependencies.each {

versionKeys.remove versionKey(it.group, it.name)

}

}

}

if (!versionKeys.empty) {

logger.lifecycle “\nFound ${versionKeys.size()} unused versions\n”

versionKeys.each { logger.lifecycle “${it.group}:${it.name}” }

} else {

logger.info “No unused version found”

}

}

// e.g. gradle artifactUsage -Pquery=groovy

task(group: ‘Reporting’, description: ‘Displays all projects where a artifact contains -Pquery’, ‘artifactUsage’) << {

if (project.hasProperty(‘query’)) {

allprojects.each { project ->

def found = []

project.configurations.all { configuration ->

configuration.dependencies.each {

def depString = “${it.group}:${it.name}:${it.version}”

if (depString.toLowerCase().contains(query.toLowerCase())) {

found.add “${depString} (${configuration.name})”

}

}

}

if (!found.empty) {

logger.lifecycle “\n${project.path}”

found.each { logger.lifecycle it }

}

}

}

}

But it fails with both >–refresh-dependencies --no-daemon --debug clean build >and >–refresh-dependencies --daemon --debug clean build

OK so it doesn’t look like a daemon issue: I’ll change the title of this post.

This is definitely a regression. I reverted to Gradle 1.3 and everything worked fine again. Jenkins is using gradlew to build.

Yep, if your build works with Gradle 1.3 and not with Gradle 1.4 and you’re only relying on the public API, then this is a regression. The next step is for us to work out what’s going wrong. There are 2 ways that you can help us do this: 1. Provide a self-contained Gradle project (shared via GitHub) that I can run to reproduce this issue. Since you have a pretty sophisticated setup this might be tricky to achieve. 2. Provide the full output of running ‘–refresh-dependencies --no-daemon --debug clean build’ both with v1.3 and with v1.4-rc-1. The best way to share the output is to use a pastebin service like https://gist.github.com. If you’re not comfortable sharing the output in the forum, you can email it to me directly (darrell.deboer@gradleware.com).

Thanks for your detailed feedback so far. The whole point of having an RC is for us to track down and fix any regressions that might have been inadvertently introduced.

I’ll send you an email shortly.

I suspect that the problem is caused by ‘Mac OS X;10.7.5;x86_64) (Apple Inc.;1.6.0_29;20.4-b02-402’ since I did a build on my local machine with 10.8.2 and Java 7 Update 11 without any problems.

The “daemon” in the original title was the Jenkins daemon of a remote Jenkins build, not the Gradle daemon, i.e. the build just suddenly stopped. I didn’t understand the message correctly at first.

OK. Just make sure you’re testing with ‘–refresh-dependencies’, otherwise artifact caching may mask real problems with dependency resolution.

The email is out. I hope it didn’t bounce because of the large attachment.

Thanks for the information. I think I’ve managed to track down the issue, which is not logged as GRADLE-2641.

FYI: This is now fixed on master. We currently plan to have a 2nd relase candidate available tomorrow.

cheers, René

Huxi, can you please try out Gradle-1.4-rc-2? We’ve fixed an issue with resolution of parent pom files that was causing an infinite loop like you were seeing.

Yep, works with Gradle 1.4-rc-2.

Thanks for the really fast fix!

Thanks for the info. ^^

No problem. Thanks so much for trying out the RC. Without users like you giving us feedback, regressions could easily slip into the final release.