Maven and snapshots?

I am working on a quick project, from which I directly work on a module that is constantly changing. Others are directly dependent on the module, and as such I removed the public interface and deployed it to our local Nexus repository as 0.0-SNAPSHOT for use.

Now that I have almost completed my first iteration of the module, I tried to redeploy the updated artifact. When reading about snapshots, others argue that the snapshot should represent the current head trunk. It's true?

Maven automatically zooms in on my version of the snapshot when redeploying - therefore, moving from 0.0-SNAPSHOT , I'm still at 0.0-SNAPSHOT , this is an iteration of 3 or 4 of the same snapshot. When do I need to switch to 0.1-SNAPSHOT ? Is there a plugin that I can use to automate version changes, instead of manually editing my pom?

After testing the integration and deployment of our first release of the 1.0-RELEASE , how should my module progress? Should I move my module to 1.0-SNAPSHOT and continue it? Is there a methodology to follow, or is it left to the discretion of the developer?

+4
source share
3 answers

The XYZ-SNAPSHOT designation identifies the temporary versions leading up to the release of XYZ, so you usually do not move from XYZ-SNAPSHOT to XYZ + 1-SNAPSHOT unless you adhere to XYZ If you adhere to this agreement, maven-release-plugin can help you with complete release process.

Note that the most common Maven convention uses 3-number release identifiers without any suffix (i.e. no -RELEASE). Suffixes are commonly used to distinguish between variants of the same release.

Maven is all agreements, so you have little chance that you will go very far without reading about it: book is a good starting point.

+6
source

To upgrade your version of POM without a manual update, you can take a look at the Maven Release plugin (although I wrote a little script to do a POM update, since I find that the Release plugin does not match this good in my workflow)

Then it will come to the version number. This is more of a release issue. Usually, a planned release is indicated by incrementing a Major or Minor version in the version number. The SNAPSHOT version means that a specific release is in progress. For example, I would rather do something similar for your case:

Suppose I plan to release the first iteration as 0.1, then I will make my head trunk in SCM (e.g. trunk in SVN) with version 0.1-SNAPSHOT as version. This means that all developments actually contribute to the release of version 0.1. Upon completion, I upgrade the POM version from 0.1-SNAPSHOT to 0.1, run the actual version 0.1 (including branching releases, tagging, deploying the artifact), and then change the POM version to SNAPSHOT of the next scheduled release (for example, 0.2-SNAPSHOT).

Similarly, after the release of 1.0 (or 1.0-RELEASE in your example), the POM version in the head trunk should then be updated to a snapshot of your next version version, such as 1.1-SNAPSHOT.

Just keep in mind that there should no longer be SNAPSHOTs of a specific version if this version is indeed released.

+3
source

Understand how maven interprets SNAPSHOTS to eliminate any doubts you may have.

Excerpt from http://books.sonatype.com/mvnref-book/reference/pom-relationships-sect-pom-syntax.html

For example, if your project has version "1.0-SNAPSHOT" and you deploy these project artifacts to the Maven repository, Maven will expand this version to "1.0-20080207-230803-1" if you intend to deploy the release at 11:08 PM on February 7 2008 UTC

First, let me suggest you stick with the maven rules and change your version to 0.1 as the maven archetype:generate suggest.

So, SNAPSHOT helps others easily update with your active project. At each compilation, their projects will check for new versions of SNAPSHOTS dependencies (based on this pseudo- .m2 version in the .m2 directory).

When you finish work on 0.1-SNAPSHOT , you will expand 0.1 and run a 0.2-SNAPSHOT or 1.0-SNAPSHOT

0
source

All Articles