@Mojo(name="parse-version",
defaultPhase=VALIDATE,
threadSafe=true)
public class ParseVersionMojo
extends AbstractDefinePropertyMojo
[propertyPrefix].majorVersion [propertyPrefix].minorVersion [propertyPrefix].incrementalVersion [propertyPrefix].qualifier [propertyPrefix].buildNumberWhere the propertyPrefix is the string set in the mojo parameter. Note that the behaviour of the parsing is determined by org.apache.maven.artifact.versioning.DefaultArtifactVersion An osgi compatible version will also be created and made available through the property:
[propertyPrefix].osgiVersionThis version is simply the original version string with the first instance of '-' replaced by '.' For example, 1.0.2-beta-1 will be converted to 1.0.2.beta-1
| Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
propertyPrefix
Prefix string to use for the set of version properties.
|
private java.lang.String |
versionString
The version string to parse.
|
| Constructor and Description |
|---|
ParseVersionMojo() |
| Modifier and Type | Method and Description |
|---|---|
private void |
defineVersionProperty(java.lang.String name,
int value) |
private void |
defineVersionProperty(java.lang.String name,
java.lang.String value) |
void |
execute()
Execute the mojo.
|
java.lang.String |
getOsgiVersion(org.apache.maven.artifact.versioning.ArtifactVersion version)
Make an osgi compatible version String from an ArtifactVersion
|
void |
parseVersion(java.lang.String version)
Parse a version String and add the components to a properties object.
|
void |
setPropertyPrefix(java.lang.String prefix)
Set property name prefix.
|
defineProperty, getProject@Parameter(defaultValue="${project.version}")
private java.lang.String versionString
@Parameter(defaultValue="parsedVersion") private java.lang.String propertyPrefix
public void execute()
org.apache.maven.plugin.MojoExecutionException - if the plugin execution fails.private void defineVersionProperty(java.lang.String name,
java.lang.String value)
private void defineVersionProperty(java.lang.String name,
int value)
public void parseVersion(java.lang.String version)
version - the version to parsepublic void setPropertyPrefix(java.lang.String prefix)
prefix - The prefix to be used.public java.lang.String getOsgiVersion(org.apache.maven.artifact.versioning.ArtifactVersion version)
version - The artifact version.