Gradle dependencies - Latest snapshot

2019-06-21 18:23发布

问题:

I have a gradle multi-project build.

In one project, I have defined some dependencies on other JARs, and have used the '+' to always depend on the latest version of the JAR e.g.

runtime group:'com.app', name: 'core', version: '+'

This works great, and anytime I re-build a version of the core project, this project picks up the latest JAR as expected.

However, this only seems to work when I explicitly build the JAR with a version - but SNAPSHOT builds are not picked up.

For example, if I have core-1.0.1.jar then my project uses that, then I build core-1.0.2.jar and the project will pcik up that new jar, however if I then build a snapshot version of the jar like core-SNAPSHOT.jar, then the project remains using 1.0.2 version.

(I know its not good to depend on snapshots - but I will be running this with my CI server building the numbered versions and installing to the repo, but when in dev I want to be able to build adhoc snapshot builds and be able to use them without changing config)

Is this possible? I have not been able to find any info about doing this?

回答1:

Normally, snapshots always include a version number (e.g. 1.0.3-SNAPSHOT). I think it's not picking it up because as it stands, SNAPSHOT is considered a lower version than 1.0.2.