svn commit: r170614 - in /maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/release: AbstractReleaseMojo.java PerformReleaseMojo.java

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r170614 - in /maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/release: AbstractReleaseMojo.java PerformReleaseMojo.java

Emmanuel Venisse
Author: evenisse
Date: Tue May 17 09:07:47 2005
New Revision: 170614

URL: http://svn.apache.org/viewcvs?rev=170614&view=rev
Log:
Run goals at the end of perform release. The default goals are "deploy site:site site:deploy".

Modified:
    maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/release/AbstractReleaseMojo.java
    maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/release/PerformReleaseMojo.java

Modified: maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/release/AbstractReleaseMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/release/AbstractReleaseMojo.java?rev=170614&r1=170613&r2=170614&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/release/AbstractReleaseMojo.java (original)
+++ maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/release/AbstractReleaseMojo.java Tue May 17 09:07:47 2005
@@ -83,9 +83,25 @@
      */
     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()
     {

Modified: maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/release/PerformReleaseMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/release/PerformReleaseMojo.java?rev=170614&r1=170613&r2=170614&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/release/PerformReleaseMojo.java (original)
+++ maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/release/PerformReleaseMojo.java Tue May 17 09:07:47 2005
@@ -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()
@@ -45,6 +63,24 @@
         catch ( Exception 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 );
         }
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]