Kannan Ramamoorthy
Kannan Ramamoorthy

Reputation: 4190

Gradle/Maven download snapshot when no release available

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?

Upvotes: 1

Views: 274

Answers (2)

Musema
Musema

Reputation: 105

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.

Upvotes: 1

Chris S.
Chris S.

Reputation: 192

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.

Upvotes: 2

Related Questions