I have currently been working on my first Maven project and have run into some confusion with Maven versioning. I understand that while developing a new version the SNAPSHOT keyword should be used in the version number. I also understand that a non SNAPSHOT version should only be released once.
I was wondering if it were possible to delete an old version from a Maven remote repository. For example, if I don’t version want 1.0.2
downloadable anymore, what should I do?
Additionally, Let’s say I am working on version 1.0-SNAPSHOT
. When I deploy version 1.0
, will the last 1.0-SNAPSHOT
version be deleted/replaced by its non SNAPSHOT counterpart?
Advertisement
Answer
Simple answer to this: A release version (without SNAPSHOT) is immutable. This includes it will be kept forever.
The reason is:
If someone uses your version
1.0.2
and you simply can delete it those > builds will fail without an obvious reason.
One word about the thing you mentioned:
I also understand that a non SNAPSHOT version should only be released once.
You can not release the same version twice. Never possible and should never. This would mean you would override and existing version which changes behaviour. This could also break other builds.
You can take a look at for example https://search.maven.org/artifact/javax.mail/mail you will find artifacts which are more than fifteen years old. They will never deleted cause It could be the case that someone is using them.
If you have an issue in your version 1.0.2
just simply create a new version 1.0.3
which fixes the issues. The version number should follow semantical versioning.
If you are running a version 1.0-SNAPSHOT
during development and making a release of it (usually via maven-release-plugin) during the release of 1.0
usually the 1.0-SNAPSHOT
versions will be automatically deleted. So the 1.0-SNAPSHOT
is no longer available. This is the default configuration for maven repository managers.