I build an own library that I deploy on a nexus repository. This snapshot is changed very often, therefore not every change gets a new version number. My problem is that I don't get the newest code without changing the version number in project that use this library. I tried "--refresh-dependencies" and I also tried to clear the dependency from the cache by deleting the folder of this dependency under "\caches\modules-2\files-2.1\my.dependency"
I also tried this:
configurations.all { resolutionStrategy.cacheChangingModulesFor 0, 'seconds' }
Has anyone an idea how I can force grade to download the newest status of a dependency despite the version number didn't change?
Simply open the gradle tab (can be located on the right) and right-click on the parent in the list (should be called "Android"), then select "Refresh dependencies". This should resolve your issue.
An example of this type of changing module is a Maven SNAPSHOT module, which always points at the latest artifact published. In other words, a standard Maven snapshot is a module that is continually evolving, it is a "changing module". Using dynamic versions and changing modules can lead to unreproducible builds.
First make sure your snapshot has the right version format:
dependencies { compile group: "groupId", name: "artifactId", version: "1.0-SNAPSHOT" }
If you have not used the -SNAPSHOT
suffix (or you are not using a Maven repository), you have to indicate that your dependency is changing:
dependencies { compile group: "groupId", name: "artifactId", version: "1.0", changing: true }
Then you have to tell Gradle not to cache changing dependencies, otherwise it will only update them every 24 hours:
configurations.all { resolutionStrategy.cacheChangingModulesFor 0, 'seconds' }
In case you have also configured the dependency as a dynamic version like this:
dependencies { compile group: "groupId", name: "artifactId", version: "1+", changing: true }
Then you have to add:
configurations.all { resolutionStrategy.cacheChangingModulesFor 0, 'seconds' resolutionStrategy.cacheDynamicVersionsFor 0, 'seconds' }
Note that this might slow your build a lot.
If this doesn't help, remove the relevant parts of .gradle
directory, or simply the whole directory again.
If that doesn't help neither, I am afraid it will be an issue on your repository side.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With