Question

Whenever I want to create a new version of my projects, I have to go in and edit the <version> tag in the POM files.

The projects are related, so they have the same version, most of the time. Is it possible to just put the new version in some file, and have the POM regenerated when needed?

Thanks

Was it helpful?

Solution

The best thing in such situations is to use the release plugin which supports automatically changing the version in the pom and creating a tag/label in the appropriate VCS. There are two steps release:prepare and release:perform which can simply be combined.

A command like this:

mvn release:prepare release:prepare

will do all needed steps like making a tag in VCS, change pom's version and deploy the artifacts to your repository. But the prerequesite is having correct entries in the SCM area of your pom, correctly configured the distributionManagement etc.

If the project comprises of several modules which have the same version this sounds like using a multi-module build instead of separated projects which would solve the problem of changing the version manually.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top