Class CreateMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
The build number is based on the revision number retrieved from SCM. It is known to work with Subversion, GIT, and Mercurial.
This mojo can also check to make sure that you have checked everything into SCM, before issuing the build number. That behaviour can be suppressed, and then the latest local build number is used.
Build numbers are not automatically reflected in your artifact's filename, but can be added to the metadata. You can access the build number in your pom with ${buildNumber}. You can also access ${timestamp} and the SCM branch of the build (if applicable) in ${scmBranch}
Note that there are several doFoo parameters. These parameters (doCheck, doUpdate, etc)
are the first thing evaluated. If there is no matching expression, we get the default-value. If there is (ie
-Dmaven.buildNumber.doUpdate=false), we get that value. So if the XML contains
<doCheck>true</doCheck>, then normally that's the final value of the param in question. However,
this mojo reverses that behaviour, such that the command line parameters get the last say.
- Author:
- Julian Wood
-
Field Summary
Fields inherited from class org.codehaus.mojo.build.AbstractScmMojo
password, project, revisionOnScmFailure, scmConnectionUrl, scmDeveloperConnectionUrl, scmDirectory, scmManager, scmTag, settings, shortRevisionLength, skip, usernameFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()protected StringfilterBranchFromScmUrl(String scmUrl) Get the revision info from the repository.Get the branch info for this revision from the repository.List<org.apache.maven.scm.ScmFile> voidsetBuildNumberPropertiesFileLocation(File buildNumberPropertiesFileLocation) voidsetDoCheck(boolean doCheck) voidsetDoUpdate(boolean doUpdate) voidsetPassword(String password) voidsetRevisionOnScmFailure(String revisionOnScmFailure) voidsetScmDirectory(File scmDirectory) voidsetScmManager(org.apache.maven.scm.manager.ScmManager scmManager) voidsetShortRevisionLength(int shortRevision) voidvoidsetUsername(String username) List<org.apache.maven.scm.ScmFile> update()Methods inherited from class org.codehaus.mojo.build.AbstractScmMojo
checkResult, getScmRepository, getScmRevision, infoMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Constructor Details
-
CreateMojo
public CreateMojo()
-
-
Method Details
-
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
-
update
public List<org.apache.maven.scm.ScmFile> update() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getStatus
- Throws:
org.apache.maven.scm.ScmException
-
getScmBranch
Get the branch info for this revision from the repository. For svn, it is in svn info.- Returns:
- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoExecutionException
-
filterBranchFromScmUrl
-
getRevision
Get the revision info from the repository. For svn, it is svn info- Returns:
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
setScmManager
public void setScmManager(org.apache.maven.scm.manager.ScmManager scmManager) -
setUrlScm
-
setUsername
-
setPassword
-
setDoCheck
public void setDoCheck(boolean doCheck) -
setDoUpdate
public void setDoUpdate(boolean doUpdate) -
setBuildNumberPropertiesFileLocation
-
setScmDirectory
-
setRevisionOnScmFailure
-
setShortRevisionLength
public void setShortRevisionLength(int shortRevision)
-