mirror of https://github.com/apache/maven.git
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:
parent
973126a114
commit
b57dc49ad9
|
@ -83,10 +83,26 @@ public abstract class AbstractReleaseMojo
|
||||||
*/
|
*/
|
||||||
private String tag;
|
private String tag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @parameter expression="${project}"
|
||||||
|
* @required
|
||||||
|
* @readonly
|
||||||
|
*/
|
||||||
|
private MavenProject project;
|
||||||
|
|
||||||
private PlexusContainer container;
|
private PlexusContainer container;
|
||||||
|
|
||||||
private ScmManager scmManager;
|
private ScmManager scmManager;
|
||||||
|
|
||||||
|
public MavenProject getProject()
|
||||||
|
{
|
||||||
|
return project;
|
||||||
|
}
|
||||||
|
public String getWorkingDirectory()
|
||||||
|
{
|
||||||
|
return workingDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
protected ScmManager getScmManager()
|
protected ScmManager getScmManager()
|
||||||
{
|
{
|
||||||
return scmManager;
|
return scmManager;
|
||||||
|
|
|
@ -17,6 +17,16 @@ package org.apache.maven.plugin.release;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
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
|
* @goal perform
|
||||||
|
@ -29,10 +39,18 @@ import org.apache.maven.plugin.MojoExecutionException;
|
||||||
public class PerformReleaseMojo
|
public class PerformReleaseMojo
|
||||||
extends AbstractReleaseMojo
|
extends AbstractReleaseMojo
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @parameter expression="${goals}"
|
||||||
|
* @required
|
||||||
|
*/
|
||||||
|
private String goals = "deploy site:site site:deploy";
|
||||||
|
|
||||||
protected void executeTask()
|
protected void executeTask()
|
||||||
throws MojoExecutionException
|
throws MojoExecutionException
|
||||||
{
|
{
|
||||||
checkout();
|
checkout();
|
||||||
|
|
||||||
|
runGoals();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkout()
|
private void checkout()
|
||||||
|
@ -47,4 +65,22 @@ public class PerformReleaseMojo
|
||||||
throw new MojoExecutionException( "An error is occurred in the checkout process.", e );
|
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 );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue