Run goals at the end of perform release. The default goals are "deploy site:site site:deploy".

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@170614 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Emmanuel Venisse 2005-05-17 16:07:47 +00:00
parent 973126a114
commit b57dc49ad9
2 changed files with 52 additions and 0 deletions

View File

@ -83,10 +83,26 @@ public abstract class AbstractReleaseMojo
*/
private String tag;
/**
* @parameter expression="${project}"
* @required
* @readonly
*/
private MavenProject project;
private PlexusContainer container;
private ScmManager scmManager;
public MavenProject getProject()
{
return project;
}
public String getWorkingDirectory()
{
return workingDirectory;
}
protected ScmManager getScmManager()
{
return scmManager;

View File

@ -17,6 +17,16 @@
*/
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.cli.CommandLineException;
import org.codehaus.plexus.util.cli.CommandLineUtils;
import org.codehaus.plexus.util.cli.Commandline;
import org.codehaus.plexus.util.cli.DefaultConsumer;
import org.codehaus.plexus.util.cli.StreamConsumer;
import sun.security.action.GetLongAction;
import sun.tools.jar.CommandLine;
/**
* @goal perform
@ -29,10 +39,18 @@
public class PerformReleaseMojo
extends AbstractReleaseMojo
{
/**
* @parameter expression="${goals}"
* @required
*/
private String goals = "deploy site:site site:deploy";
protected void executeTask()
throws MojoExecutionException
{
checkout();
runGoals();
}
private void checkout()
@ -47,4 +65,22 @@ private void checkout()
throw new MojoExecutionException( "An error is occurred in the checkout process.", e );
}
}
private void runGoals()
throws MojoExecutionException
{
Commandline cl = new Commandline();
cl.setExecutable( "m2" );
cl.setWorkingDirectory( getWorkingDirectory() );
cl.createArgument().setLine( goals );
StreamConsumer consumer = new DefaultConsumer();
try
{
CommandLineUtils.executeCommandLine( cl, consumer, consumer );
}
catch ( CommandLineException e )
{
throw new MojoExecutionException( "Can't run goal " + goals, e );
}
}
}