maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r398830 - in /maven/plugins/trunk/maven-release-plugin/src: main/java/org/apache/maven/plugins/release/phase/ main/resources/META-INF/plexus/ test/java/org/apache/maven/plugins/release/phase/
Date Tue, 02 May 2006 06:54:38 GMT
Author: brett
Date: Mon May  1 23:54:34 2006
New Revision: 398830

URL: http://svn.apache.org/viewcvs?rev=398830&view=rev
Log:
[MRELEASE-98] rationalise goal execution phases

Added:
    maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/RunGoalsPhase.java
  (contents, props changed)
      - copied, changed from r398826, maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/RunTestsPhase.java
    maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/RunGoalsPhaseTest.java
  (contents, props changed)
      - copied, changed from r398826, maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/RunTestsPhaseTest.java
Removed:
    maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/RunPreparationGoalsPhase.java
    maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/RunTestsPhase.java
    maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/RunTestsPhaseTest.java
Modified:
    maven/plugins/trunk/maven-release-plugin/src/main/resources/META-INF/plexus/components.xml

Copied: maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/RunGoalsPhase.java
(from r398826, maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/RunTestsPhase.java)
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/RunGoalsPhase.java?p2=maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/RunGoalsPhase.java&p1=maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/RunTestsPhase.java&r1=398826&r2=398830&rev=398830&view=diff
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/RunTestsPhase.java
(original)
+++ maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/RunGoalsPhase.java
Mon May  1 23:54:34 2006
@@ -21,13 +21,14 @@
 import org.apache.maven.plugins.release.exec.MavenExecutor;
 import org.apache.maven.plugins.release.exec.MavenExecutorException;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
+import org.codehaus.plexus.util.StringUtils;
 
 /**
  * Run the integration tests for the project to verify that it builds before committing.
  *
  * @author <a href="mailto:brett@apache.org">Brett Porter</a>
  */
-public class RunTestsPhase
+public class RunGoalsPhase
     extends AbstractLogEnabled
     implements ReleasePhase
 {
@@ -36,13 +37,21 @@
      */
     private MavenExecutor mavenExecutor;
 
+    /**
+     * The goals to run.
+     */
+    private String goals;
+
     public void execute( ReleaseConfiguration releaseConfiguration )
         throws ReleaseExecutionException
     {
         try
         {
-            mavenExecutor.executeGoals( releaseConfiguration.getWorkingDirectory(), "clean
integration-test",
-                                        releaseConfiguration.isInteractive() );
+            if ( !StringUtils.isEmpty( goals ) )
+            {
+                mavenExecutor.executeGoals( releaseConfiguration.getWorkingDirectory(), goals,
+                                            releaseConfiguration.isInteractive() );
+            }
         }
         catch ( MavenExecutorException e )
         {

Propchange: maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/RunGoalsPhase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/RunGoalsPhase.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/plugins/trunk/maven-release-plugin/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/main/resources/META-INF/plexus/components.xml?rev=398830&r1=398829&r2=398830&view=diff
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/main/resources/META-INF/plexus/components.xml
(original)
+++ maven/plugins/trunk/maven-release-plugin/src/main/resources/META-INF/plexus/components.xml
Mon May  1 23:54:34 2006
@@ -137,17 +137,25 @@
     <component>
       <role>org.apache.maven.plugins.release.phase.ReleasePhase</role>
       <role-hint>run-tests</role-hint>
-      <implementation>org.apache.maven.plugins.release.phase.RunTestsPhase</implementation>
+      <implementation>org.apache.maven.plugins.release.phase.RunGoalsPhase</implementation>
       <requirements>
         <requirement>
           <role>org.apache.maven.plugins.release.exec.MavenExecutor</role>
         </requirement>
       </requirements>
+      <configuration>
+        <goals>clean integration-test</goals>
+      </configuration>
     </component>
     <component>
       <role>org.apache.maven.plugins.release.phase.ReleasePhase</role>
       <role-hint>run-preparation-goals</role-hint>
-      <implementation>org.apache.maven.plugins.release.phase.RunPreparationGoalsPhase</implementation>
+      <implementation>org.apache.maven.plugins.release.phase.RunGoalsPhase</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.plugins.release.exec.MavenExecutor</role>
+        </requirement>
+      </requirements>
     </component>
     <component>
       <role>org.apache.maven.plugins.release.phase.ReleasePhase</role>

Copied: maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/RunGoalsPhaseTest.java
(from r398826, maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/RunTestsPhaseTest.java)
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/RunGoalsPhaseTest.java?p2=maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/RunGoalsPhaseTest.java&p1=maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/RunTestsPhaseTest.java&r1=398826&r2=398830&rev=398830&view=diff
==============================================================================
--- maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/RunTestsPhaseTest.java
(original)
+++ maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/RunGoalsPhaseTest.java
Mon May  1 23:54:34 2006
@@ -25,6 +25,7 @@
 import org.jmock.core.constraint.IsEqual;
 import org.jmock.core.constraint.IsSame;
 import org.jmock.core.matcher.InvokeOnceMatcher;
+import org.jmock.core.matcher.TestFailureMatcher;
 import org.jmock.core.stub.ThrowStub;
 
 import java.io.File;
@@ -34,17 +35,17 @@
  *
  * @author <a href="mailto:brett@apache.org">Brett Porter</a>
  */
-public class RunTestsPhaseTest
+public class RunGoalsPhaseTest
     extends PlexusTestCase
 {
-    private RunTestsPhase phase;
+    private RunGoalsPhase phase;
 
     protected void setUp()
         throws Exception
     {
         super.setUp();
 
-        phase = (RunTestsPhase) lookup( ReleasePhase.ROLE, "run-tests" );
+        phase = (RunGoalsPhase) lookup( ReleasePhase.ROLE, "run-tests" );
     }
 
     public void testExecute()
@@ -141,5 +142,27 @@
         {
             assertEquals( "Check cause", MavenExecutorException.class, e.getCause().getClass()
);
         }
+    }
+
+    public void testPreparationGoals()
+        throws Exception
+    {
+        // this has no goals by default
+        phase = (RunGoalsPhase) lookup( ReleasePhase.ROLE, "run-preparation-goals" );
+
+        File testFile = getTestFile( "target/working-directory" );
+
+        ReleaseConfiguration config = new ReleaseConfiguration();
+        config.setWorkingDirectory( testFile );
+
+        Mock mock = new Mock( MavenExecutor.class );
+        mock.expects( new TestFailureMatcher( "Shouldn't invoke executeGoals" ) ) .method(
"executeGoals" );
+
+        phase.setMavenExecutor( (MavenExecutor) mock.proxy() );
+
+        phase.execute( config );
+
+        // just needs to survive the mock
+        assertTrue( true );
     }
 }

Propchange: maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/RunGoalsPhaseTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/RunGoalsPhaseTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision



Mime
View raw message