I’m using Gradle 2.7 with a Maven 2 repository. My repo is hosted on the (non-pro) version of Artifactory, configured as generic with a Maven 2 layout. I’m trying to embrace true continuous delivery whereby ALL my builds are potential release candidates; semantic versioning doesn’t really make sense with how my project and delivery model is set up. As a result, I’m using what I believe is a non-standard build versioning system in my Maven repo. Example, builds look like this:
foo-20151121-153045-LATEST.jar
The builds above have form ARTIFACT_ID-TIMESTAMP-BUILD_TAG.jar where the build tag is updated as builds progress through more levels of testing.
To reference the latest version in my Gradle script I have:
I have two builds in my repo such as foo-20151121-153045-LATEST.jar and foo-20151121-153150-LATEST.jar (notice the second has a more recent timestamp) the Gradle build will not pull down the newer version. The only way I can get it to pull down the latest build is by using the --refresh--dependencies flag for my build, but this seems very hacky.
Have I simply broken how Maven repositories work with my custom versioning system? Or is there something I’m doing wrong or missing?
what you declared here with your custom versioning strategy is not a changing module since the version changes for every new released artifact (the timestamp part of your version). So instead of setting cacheChangingModulesFor you should set cacheDynamicVersionsFor. Try this snippet instead:
I wasn’t aware of this option in Gradle. Is there any documentation that clarifies the difference between changing modules and dynamic versions?
Regarding this zero second cache timeout, am I right in assuming it won’t affect “normal” dependencies? I don’t want to be re-downloading everything from MavenCentral on every build, for example; I just want to download dependencies on my own project builds.
With the snippet above you’re only configuring dependencies that are used within your build. This usually means thirdparty Gradle plugins or libraries that you use in your build logic. There is a section that explains the difference between changing modules and dynamic versions in the Dependency Management Best Practices chapter of the Gradle user guide.