@Mojo(name="create", defaultPhase=INITIALIZE, requiresProject=true, threadSafe=true) public class CreateMojo extends AbstractScmMojo
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.
password, project, revisionOnScmFailure, scmConnectionUrl, scmDeveloperConnectionUrl, scmDirectory, scmManager, scmTag, settings, shortRevisionLength, skip, username
Constructor and Description |
---|
CreateMojo() |
Modifier and Type | Method and Description |
---|---|
void |
execute() |
protected java.lang.String |
filterBranchFromScmUrl(java.lang.String scmUrl) |
java.lang.String |
getRevision()
Get the revision info from the repository.
|
java.lang.String |
getScmBranch()
Get the branch info for this revision from the repository.
|
java.util.List<org.apache.maven.scm.ScmFile> |
getStatus() |
void |
setBuildNumberPropertiesFileLocation(java.io.File buildNumberPropertiesFileLocation) |
void |
setDoCheck(boolean doCheck) |
void |
setDoUpdate(boolean doUpdate) |
void |
setPassword(java.lang.String password) |
void |
setRevisionOnScmFailure(java.lang.String revisionOnScmFailure) |
void |
setScmDirectory(java.io.File scmDirectory) |
void |
setScmManager(org.apache.maven.scm.manager.ScmManager scmManager) |
void |
setShortRevisionLength(int shortRevision) |
void |
setUrlScm(java.lang.String urlScm) |
void |
setUsername(java.lang.String username) |
java.util.List<org.apache.maven.scm.ScmFile> |
update() |
checkResult, getScmRepository, getScmRevision, info
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
public java.util.List<org.apache.maven.scm.ScmFile> update() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
public java.util.List<org.apache.maven.scm.ScmFile> getStatus() throws org.apache.maven.scm.ScmException
org.apache.maven.scm.ScmException
public java.lang.String getScmBranch() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected java.lang.String filterBranchFromScmUrl(java.lang.String scmUrl)
public java.lang.String getRevision() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
public void setScmManager(org.apache.maven.scm.manager.ScmManager scmManager)
public void setUrlScm(java.lang.String urlScm)
public void setUsername(java.lang.String username)
public void setPassword(java.lang.String password)
public void setDoCheck(boolean doCheck)
public void setDoUpdate(boolean doUpdate)
public void setBuildNumberPropertiesFileLocation(java.io.File buildNumberPropertiesFileLocation)
public void setScmDirectory(java.io.File scmDirectory)
public void setRevisionOnScmFailure(java.lang.String revisionOnScmFailure)
public void setShortRevisionLength(int shortRevision)
Copyright © 2007–2024 MojoHaus. All rights reserved.