Gradle fails to resolve dependencies

(Olaf) #1

We are building some internal libraries to upload them to our company’s nexus.
Libraries are successfully uploaded: I can find the timestamp of the latest upload in the nexus webfrontend. I also can download and verify them manually: it works.

Now another gradle project uses that nexus to resolve the dependency. But now I am again in a situation: it fails almost always to resolve the new version of the snapshot library. It simply compiles with the old and obsolete version of the snapshot.

We are using Eclipse Oxygen with Buildship under Windows as well as under Ubuntu.

Even using the command line gradlew does not fix this issue.

We tried all combinations of
task ‘clean’ followed by task 'builld’
task 'eclipse’
gradlew --stop
gradlew cleanEclipseClasspath eclipse
gradlew --refresh-dependencies
kill the several gradle processes manually and start a 'build’
task ‘cleanEclipse’ followed by task 'eclipse’
restart eclipse
refresh the gradle project in Eclipse
followed by
gradlew build
gradlew war
gradlew compile

(BTW: Here some other issues are some kind of uncomfortable. For example: ‘gradlew cleaneclipse eclipse’ removes the ‘Gradle nature’ of the project. Calling this tasks from Eclipse makes the project remove itself from being displayd in the gradle tasks.)

Changing the dependency to a version-token, that does not exist in the Nexus makes Gradle fail as expected. Changing back to the existing version, still takes the old obsolete version of the library.
Uploading a new version-token of the snapshot and changing the second project to the new snapshot version-token also works. But as you might guess, that is not our intention.

How can I force Gradle to resolve the most current version of the dependencies of the artifact repo?
Or how can I force Gradle to not use obsolete snapshots any more?

(Olaf) #2

I think this is solved: It seems that Gradle some how takes the proxy configuration of Eclipse and/or the OS. If there is a proxy specified, the team {artifact server/proxy/Gradle} fail to deliver updated contents.

Manually disabling the proxy whenever I use Gradle fixes the issue. Even that is inconvenient and in some situations it is simply not possible, because in some situations the artifact server will not be reachable any more.

I think, in regards to snapshot updates on an artifact servers it would be nice not to cache contents or at least force an update of the artifact hashes through the cache. I am not a http proxy expert. But however - it seems there is some potential for optimizing. I guess having a proxy in the game is not that unusual.