Search code examples
mavenmaven-release-pluginmaven-versions-plugin

Maven update property based on version


I would like to update a property in a given pom to the major+minor version of the new version when I perform a release.

To do this, I need to set goals to run during the release. I can calculate the property ahead of time, but the versions:set-property I've seen elsewhere appears to be gone (according to http://www.mojohaus.org/versions-maven-plugin/ and CLI use), and other goals for this plugin don't seem to be able to handle not using the exact version.

Is there any reasonably simple way to do this, or do I have to shell out to the exec or antrun plugins to do it? Regardless, it seems that there's nothing but text replacing that will fix it. The replacer plugin seems to work, but that requires grabbing the previous version, and would take work to not break other references.


Solution

  • The Maven build helper plugin can set properties using regex. Maybe this is what you need.