build-helper:parse-version
Full name:
org.codehaus.mojo:build-helper-maven-plugin:3.5.0:parse-version
Description:
Parse a version string and set properties containing the component parts of the version. This mojo sets the following properties:
Where the propertyPrefix is the string set in the mojo parameter. The parsing of the above is based on the following format of the version:
It will be tried to parse the version as an OSGi version. It this is successful the following property will be set accordingly. If this is not possible a warning will be emitted.
This goal also sets the following properties:
This goal also sets the following properties:
This goal also sets the following properties:
There is another property set which is named
The above properties contain simply incremented versions of the parsed version informations. Those can now be used to update the version of your project via the following to the next Major version:
It can of course being used to increment the minor version:
This can make an upgrade of the versions of your project very convenient.
[propertyPrefix].majorVersion [propertyPrefix].minorVersion [propertyPrefix].incrementalVersion [propertyPrefix].qualifier [propertyPrefix].buildNumber
<majorversion [> . <minorversion [> . <incrementalversion ] ] [> - <buildnumber | qualifier ]>
[propertyPrefix].osgiVersion
[propertyPrefix].nextMajorVersion [propertyPrefix].nextMinorVersion [propertyPrefix].nextIncrementalVersion [propertyPrefix].nextBuildNumber
[formattedPropertyPrefix].majorVersion [formattedPropertyPrefix].minorVersion [formattedPropertyPrefix].incrementalVersion [formattedPropertyPrefix].buildNumber
[formattedPropertyPrefix].nextMajorVersion [formattedPropertyPrefix].nextMinorVersion [formattedPropertyPrefix].nextIncrementalVersion [formattedPropertyPrefix].nextBuildNumber
[propertyPrefix].qualifier
and furthermore another property which is named [propertyPrefix].qualifier?
which contains a prefix -
if the qualifier contains anything otherwise the whole property is simply empty.
mvn build-helper:parse-version versions:set \ -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.nextMinorVersion}.\${parsedVersion.incrementalVersion}\${parsedVersion.qualifier?}
mvn build-helper:parse-version versions:set \ -DnewVersion=\${parsedVersion.nextMajorVersion}.0.0 \ versions:commit
mvn build-helper:parse-version versions:set \ -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.nextMinorVersion}.0 \ versions:commit
Attributes:
- Requires a Maven project to be executed.
- The goal is thread-safe and supports parallel builds.
- Since version:
1.3
. - Binds by default to the lifecycle phase:
validate
.
Optional Parameters
Name | Type | Since | Description |
---|---|---|---|
<formatBuildNumber> |
String |
3.0.0 |
See also: Formatter syntax Default value is: %02d . |
<formatIncremental> |
String |
3.0.0 |
See also: Formatter syntax Default value is: %02d . |
<formatMajor> |
String |
3.0.0 |
This can be used to make a particular format of the major number possible like padding it with zeros etc. See also: Formatter syntax Default value is: %02d . |
<formatMinor> |
String |
3.0.0 |
See also: Formatter syntax Default value is: %02d . |
<formattedPropertyPrefix> |
String |
3.0.0 |
Prefix string to use for the set of formatted version properties. Default value is: formattedVersion . |
<propertyPrefix> |
String |
- |
Prefix string to use for the set of version properties. Default value is: parsedVersion . |
<qualifierPrefix> |
String |
3.1.0 |
By using qualifierPrefix you can change the prefix which is used to prefix the qualifier if not empty.Default value is: - . |
<versionString> |
String |
- |
The version string to parse. Default value is: ${project.version} .User property is: versionString . |
Parameter Details
<formatBuildNumber>
See also: Formatter syntax
- Type:
java.lang.String
- Since:
3.0.0
- Required:
No
- Default:
%02d
<formatIncremental>
See also: Formatter syntax
- Type:
java.lang.String
- Since:
3.0.0
- Required:
No
- Default:
%02d
<formatMajor>
This can be used to make a particular format of the major number possible like padding it with zeros etc.
See also: Formatter syntax
See also: Formatter syntax
- Type:
java.lang.String
- Since:
3.0.0
- Required:
No
- Default:
%02d
<formatMinor>
See also: Formatter syntax
- Type:
java.lang.String
- Since:
3.0.0
- Required:
No
- Default:
%02d
<formattedPropertyPrefix>
Prefix string to use for the set of formatted version properties.
- Type:
java.lang.String
- Since:
3.0.0
- Required:
No
- Default:
formattedVersion
<propertyPrefix>
Prefix string to use for the set of version properties.
- Type:
java.lang.String
- Required:
No
- Default:
parsedVersion
<qualifierPrefix>
By using
qualifierPrefix
you can change the prefix which is used to prefix the qualifier if not empty.- Type:
java.lang.String
- Since:
3.1.0
- Required:
No
- Default:
-
<versionString>
The version string to parse.
- Type:
java.lang.String
- Required:
No
- User Property:
versionString
- Default:
${project.version}