1

With our system's CI/CD, the library releases will be made only when the components are tested. Until then the libraries are maintained as snapshots with the suffix '-SNAPSHOT'.

How can I make my gradle and maven projects, that depends on those libraries to download the snapshots of a specific version, when the release for that version is not available?

Kannan Ramamoorthy
  • 3,980
  • 9
  • 45
  • 63
  • Maybe I misunderstand but your sentences is a contradiction in itself ? – khmarbaise Apr 25 '18 at 20:24
  • Sorry.. which part is contradicting? – Kannan Ramamoorthy Apr 25 '18 at 20:32
  • Since -SNAPSHOT is the qualifier specified in the dependency, this is not going to be easy. Either Gradle will have to figure this out and ask for x.y.z or z.y.z-SNAPSHOT based on config, or you are going to have to come up with a different qualifier or patch level setup, possible using the much maligned "+". (It also depends on how your artifact repos are setup and searched.) –  Apr 25 '18 at 20:52

2 Answers2

2

Maven doesn't support anything like this. If you specify a version of 1.2.3 then it expects there to be a release version of 1.2.3 in your artifact repository.

1.2.3-SNAPSHOT is not the same as 1.2.3 and implies a version that can change (so maven checks for updates) - for releases maven doesn't need to check for updates because releases are supposed to be immutable by definition (so no need to check for updates).

This may seem annoying, but you'll gain repeatability in your builds if you specify releases - which will help stabilize your development process.

Chris S.
  • 192
  • 3
1

You should check versions maven plugin, what you can do is, put *X.Y.Z-SNAPSHOT* in your dependencies and remove the -SNAPSHOT suffix when releasing your artifact. By this time X.Y.Z version should be released. versions plugin has a lot of goals that may satisfy your requirement.

Musema
  • 65
  • 3