org.codehaus.mojo.build
Class CreateMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.codehaus.mojo.build.CreateMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

public class CreateMojo
extends org.apache.maven.plugin.AbstractMojo

This mojo is designed to give you a build number. So when you might make 100 builds of version 1.0-SNAPSHOT, you can differentiate between them all. The build number is based on the revision number retrieved from scm. It only works with subversion, currently. 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 reflected in your artifact's filename (automatically), 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 ${buildScmBranch}

Version:
$Id: CreateMojo.java 13542 2011-02-08 13:06:04Z struberg $
Author:
Julian Wood

Field Summary
 String DEFAULT_BRANCH_NAME
           
protected  org.apache.maven.execution.MavenSession session
           
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
CreateMojo()
           
 
Method Summary
 void execute()
           
protected  String filterBranchFromScmUrl(String scmUrl)
           
 String getRevision()
          Get the revision info from the repository.
 String getScmBranch()
          Get the branch info for this revision from the repository.
 List<org.apache.maven.scm.ScmFile> getStatus()
           
 org.apache.maven.scm.command.info.InfoScmResult info(org.apache.maven.scm.repository.ScmRepository repository, org.apache.maven.scm.ScmFileSet fileSet)
          Get info from svn.
 void setBuildNumberPropertiesFileLocation(File buildNumberPropertiesFileLocation)
           
 void setDoCheck(boolean doCheck)
           
 void setDoUpdate(boolean doUpdate)
           
 void setPassword(String password)
           
 void setRevisionOnScmFailure(String revisionOnScmFailure)
           
 void setScmDirectory(File scmDirectory)
           
 void setScmManager(org.apache.maven.scm.manager.ScmManager scmManager)
           
 void setUrlScm(String urlScm)
           
 void setUsername(String username)
           
 List<org.apache.maven.scm.ScmFile> update()
           
 
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 Detail

DEFAULT_BRANCH_NAME

public final String DEFAULT_BRANCH_NAME
See Also:
Constant Field Values

session

protected org.apache.maven.execution.MavenSession session
Constructor Detail

CreateMojo

public CreateMojo()
Method Detail

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

update

public List<org.apache.maven.scm.ScmFile> update()
                                          throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

getStatus

public List<org.apache.maven.scm.ScmFile> getStatus()
                                             throws org.apache.maven.scm.ScmException
Throws:
org.apache.maven.scm.ScmException

getScmBranch

public String getScmBranch()
                    throws org.apache.maven.plugin.MojoExecutionException
Get the branch info for this revision from the repository. For svn, it is in svn info.

Returns:
Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException

filterBranchFromScmUrl

protected String filterBranchFromScmUrl(String scmUrl)

getRevision

public String getRevision()
                   throws org.apache.maven.plugin.MojoExecutionException
Get the revision info from the repository. For svn, it is svn info

Returns:
Throws:
org.apache.maven.plugin.MojoExecutionException

info

public org.apache.maven.scm.command.info.InfoScmResult info(org.apache.maven.scm.repository.ScmRepository repository,
                                                            org.apache.maven.scm.ScmFileSet fileSet)
                                                     throws org.apache.maven.scm.ScmException
Get info from svn.

Parameters:
repository -
fileSet -
Returns:
Throws:
org.apache.maven.scm.ScmException

setScmManager

public void setScmManager(org.apache.maven.scm.manager.ScmManager scmManager)

setUrlScm

public void setUrlScm(String urlScm)

setUsername

public void setUsername(String username)

setPassword

public void setPassword(String password)

setDoCheck

public void setDoCheck(boolean doCheck)

setDoUpdate

public void setDoUpdate(boolean doUpdate)

setBuildNumberPropertiesFileLocation

public void setBuildNumberPropertiesFileLocation(File buildNumberPropertiesFileLocation)

setScmDirectory

public void setScmDirectory(File scmDirectory)

setRevisionOnScmFailure

public void setRevisionOnScmFailure(String revisionOnScmFailure)


Copyright © 2007-2012 Codehaus. All Rights Reserved.