When I add a new dependency to a script, and the library is missing from the remote repository, the build fails as expected. However, if I add the library to the repository, and then re-run the script, the build still fails.
Here’s the script:
apply plugin: 'java'
dependencies {
compile(
[group: 'test', name: 'test', version: '1.0'],
)
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
project.ext {
remoteUrl = "http://myivyrepo.com"
artifactPattern = "[organisation]/[module]/[revision]/[artifact](-[classifier])-[revision](.[ext])"
ivyPattern = "[organisation]/[module]/[revision]/[artifact](-[classifier])-[revision](.[ext])"
}
repositories {
add(new org.apache.ivy.plugins.resolver.URLResolver()) {
addIvyPattern( remoteUrl + "/" + ivyPattern )
addArtifactPattern( remoteUrl + "/" + artifactPattern
)
checkmodified = true
changingPattern = 'latest'
}
}
The first time I run this script, the Cobertura library is missing, and so the error is correct. But after I go add the library to our remote Ivy repo, it still produces the following error, even though I’ve confirmed the library is there:
* What went wrong:
Could not resolve all dependencies for configuration ':testRuntime'.
> Could not find group:test, module:test, version:1.0.
Required by:
:projectA:unspecified
Running clean doesn’t resolve it, nor does deleting the .gradle directory by hand. And running other projects with similar dependencies all fail. (I.e., copy-and-paste this build script into a completely different project and it will still fail.)
So it appears to be a problem with the cache. If I delete the cache and the re-run the script, it finds the dependency and passes.
Also, I do not have this problem if I use a local repository for resolution. For example, if I do this instead:
project.ext {
localUrl = "${System.properties['user.home']}/.ivy2/local"
artifactPattern = "[organisation]/[module]/[revision]/[artifact](-[classifier])-[revision](.[ext])"
ivyPattern = "[organisation]/[module]/[revision]/[artifact](-[classifier])-[revision](.[ext])"
}
repositories {
ivy {
url localUrl
ivyPattern ivyPattern
artifactPattern artifactPattern
}
}
Now the script fails when the artifact is missing, and as soon as I add it, re-running the build passes.
Any suggestions on this? Is this a bug, or is there something on my Ivy URLResolver that isn’t configured correctly?
PS. This is Gradle 1.1.