0

I'm using maven release plugin to deploy new versions of software. When running

mvn release:prepare
mvn release:perform

Everything works as expected. If I tell maven to release version 2.1, it publishes an artifact 2.1 as well as a 2.2-20210205.061032-1, which I guess is some kind of snapshot. I'm wondering if it´s possible to perform a release for a new snapshot version ONLY?

The use case being that I have made some changes I want to publish for testing, before commiting to a final release. Something like 2.2-SNAPSHOT, or something like 2.2-YYYYMMDD.HHmmSS-X. When prompted by maven to enter the next version, if I enter 2.2-SNAPSHOT, it just repeats the question again.

Please advice on how to achieve this, or if I'm thinking about this the wrong way.

Daniel
  • 2,050
  • 7
  • 31
  • 55

2 Answers2

4

If you want to deploy a SNAPSHOT, just run

mvn clean deploy

The Maven Release Plugin is meant for release versions.

J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142
1

SNAPSHOTs are meant to be very fluid, to the level of a dependent project "immediately" picking up changes to the SNAPSHOT dependency, whatever "immediately" means: it could be directly in an IDE, or while doing rapid builds on a command line but also on a CI server. I agree with the answer of J Fabian Meier that you can deploy a SNAPSHOT using mvn deploy.

However, if you are delivering a pre-release version for testing to a different team, you probably want them to have something that is more stable than a SNAPSHOT. When testing it is often important that you can reason about what version (or constellation of versions) you are running, and this is not quite the case with SNAPSHOTs (you may push up a new version then by quasi-accident, users may or may not force-update their SNAPSHOTs, or Maven may not look for new SNAPSHOTs until tomorrow).

You may be better off with versions that are released (from Maven's perspective) using the Maven Release Plugin (and benefit from the safeguards it offers), but just using version "numbers" that indicate it is a pre-release: 2.2-rc, 2.2-beta (I'm sure SemVer has ideas of the exact pattern to use, and so does Maven).

Sander Verhagen
  • 8,540
  • 4
  • 41
  • 63