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

    Fields
    Modifier and Type
    Field
    Description
    protected String
    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.
    protected org.apache.maven.project.MavenProject
    [Read Only] The Maven project.
    protected String
    The snapshotSuffix used to identify and strip the -SNAPSHOT version suffix See issue https://issues.alfresco.com/jira/browse/ENH-1232
    protected boolean
    Enable this option in order to replace -SNAPSHOT with the currentTimestamp of the artifact creation See issue https://issues.alfresco.com/jira/browse/ENH-1232
    protected String
    [Read Only] Current version of the project

    Fields inherited from interface org.apache.maven.plugin.Mojo

    ROLE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    protected String
    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

    Methods inherited from class org.apache.maven.plugin.AbstractMojo

    getLog, getPluginContext, setLog, setPluginContext

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • snapshotSuffix

      protected String 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 snapshotToTimestamp
      Enable 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

      protected String 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

      protected String version
      [Read Only] Current version of the project
      Required:
      Read only:
      Parameter:
      default-value="${project.version}"
  • Constructor Details

    • VersionMojo

      public VersionMojo()
  • Method Details

    • getNormalizedVersion

      protected String 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.MojoExecutionException
      org.apache.maven.plugin.MojoFailureException