Package org.alfresco.maven.plugin
Class VersionMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.alfresco.maven.plugin.VersionMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
public class VersionMojo
extends org.apache.maven.plugin.AbstractMojo
Removes -SNAPSHOT suffix from the version number (if present), optionally replacing it with a timestamp.
The result is provided in the Maven property ${noSnapshotVersion}.
This feature is mostly needed to avoid Alfresco failing when installing AMP modules with non-numeric
versions.
- Since:
- 1.0
- Version:
- $Id:$
- Goal:
- set-version
- Description:
- Parses Maven version and removes literals as not allowed in AMP versions, making a noSnapshotVersion property available for POM filtering
- Phase:
- initialize
- Requires Project:
- Thread-Safe:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringAllows to append a custom (numeric) value to the current artifact's version, i.e. appending the SCM build number can be accomplished defining <customVersionSuffix>${buildnumber}</customVersionSuffix> in the plugin configuration.protected org.apache.maven.project.MavenProject[Read Only] The Maven project.protected StringThe snapshotSuffix used to identify and strip the -SNAPSHOT version suffix See issue https://issues.alfresco.com/jira/browse/ENH-1232protected booleanEnable this option in order to replace -SNAPSHOT with the currentTimestamp of the artifact creation See issue https://issues.alfresco.com/jira/browse/ENH-1232protected String[Read Only] Current version of the projectFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
snapshotSuffix
The snapshotSuffix used to identify and strip the -SNAPSHOT version suffix See issue https://issues.alfresco.com/jira/browse/ENH-1232- Required:
- Parameter:
- property="maven.alfresco.snapshotSuffix" default-value="-SNAPSHOT"
-
snapshotToTimestamp
protected boolean snapshotToTimestampEnable this option in order to replace -SNAPSHOT with the currentTimestamp of the artifact creation See issue https://issues.alfresco.com/jira/browse/ENH-1232- Required:
- Parameter:
- property="maven.alfresco.snapshotToTimestamp" default-value="false"
-
customVersionSuffix
Allows to append a custom (numeric) value to the current artifact's version, i.e. appending the SCM build number can be accomplished defining <customVersionSuffix>${buildnumber}</customVersionSuffix> in the plugin configuration.- Parameter:
- property="maven.alfresco.customVersionSuffix"
-
project
protected org.apache.maven.project.MavenProject project[Read Only] The Maven project.- Required:
- Read only:
- Parameter:
- default-value="${project}"
-
version
[Read Only] Current version of the project- Required:
- Read only:
- Parameter:
- default-value="${project.version}"
-
-
Constructor Details
-
VersionMojo
public VersionMojo()
-
-
Method Details
-
getNormalizedVersion
Normalizes the project's version following 2 patterns - Remove the -SNAPSHOT suffix, if present - (Optionally) append the timestamp to the version, if -SNAPSHOT is present - (Optionally) append the build number to the version- Returns:
- the current project's version normalized
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-