You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by ep...@apache.org on 2006/09/14 12:30:29 UTC
svn commit: r443305 - in
/maven/continuum/branches/release-integration/maven/maven-release-plugin/src:
main/java/org/apache/maven/plugins/release/
main/java/org/apache/maven/plugins/release/exec/
main/java/org/apache/maven/plugins/release/phase/ test/j...
Author: epunzalan
Date: Thu Sep 14 03:30:17 2006
New Revision: 443305
URL: http://svn.apache.org/viewvc?view=rev&rev=443305
Log:
enabled capture of build output
Modified:
maven/continuum/branches/release-integration/maven/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/DefaultReleaseManager.java
maven/continuum/branches/release-integration/maven/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/ReleaseResult.java
maven/continuum/branches/release-integration/maven/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/exec/ForkedMavenExecutor.java
maven/continuum/branches/release-integration/maven/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/exec/MavenExecutor.java
maven/continuum/branches/release-integration/maven/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/RunGoalsPhase.java
maven/continuum/branches/release-integration/maven/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/DefaultReleaseManagerTest.java
maven/continuum/branches/release-integration/maven/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/exec/ForkedMavenExecutorTest.java
maven/continuum/branches/release-integration/maven/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/RunGoalsPhaseTest.java
Modified: maven/continuum/branches/release-integration/maven/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/DefaultReleaseManager.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/release-integration/maven/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/DefaultReleaseManager.java?view=diff&rev=443305&r1=443304&r2=443305
==============================================================================
--- maven/continuum/branches/release-integration/maven/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/DefaultReleaseManager.java (original)
+++ maven/continuum/branches/release-integration/maven/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/DefaultReleaseManager.java Thu Sep 14 03:30:17 2006
@@ -240,7 +240,7 @@
throws ReleaseExecutionException, ReleaseFailureException
{
perform( releaseDescriptor, settings, reactorProjects, checkoutDirectory, goals,
- useReleaseProfile, listener, null );
+ useReleaseProfile, listener, new ReleaseResult() );
}
public ReleaseResult performWithResult( ReleaseDescriptor releaseDescriptor, Settings settings, List reactorProjects,
@@ -402,7 +402,7 @@
try
{
mavenExecutor.executeGoals( checkoutDirectory, goals, config.isInteractive(), additionalArguments,
- config.getPomFileName() );
+ config.getPomFileName(), result );
}
catch ( MavenExecutorException e )
{
@@ -413,8 +413,10 @@
updateListener( listener, "build-project", phaseEnd );
+ updateListener( listener, "cleanup", phaseStart );
clean( config, reactorProjects );
updateListener( listener, "cleanup", phaseEnd );
+
updateListener( listener, "perform", goalEnd );
}
Modified: maven/continuum/branches/release-integration/maven/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/ReleaseResult.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/release-integration/maven/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/ReleaseResult.java?view=diff&rev=443305&r1=443304&r2=443305
==============================================================================
--- maven/continuum/branches/release-integration/maven/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/ReleaseResult.java (original)
+++ maven/continuum/branches/release-integration/maven/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/ReleaseResult.java Thu Sep 14 03:30:17 2006
@@ -77,6 +77,11 @@
stdOut.append( getStackTrace( e ) ).append( LS );
}
+ public void appendOutput( String message )
+ {
+ stdOut.append( message );
+ }
+
public String getOutput()
{
return stdOut.toString();
Modified: maven/continuum/branches/release-integration/maven/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/exec/ForkedMavenExecutor.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/release-integration/maven/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/exec/ForkedMavenExecutor.java?view=diff&rev=443305&r1=443304&r2=443305
==============================================================================
--- maven/continuum/branches/release-integration/maven/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/exec/ForkedMavenExecutor.java (original)
+++ maven/continuum/branches/release-integration/maven/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/exec/ForkedMavenExecutor.java Thu Sep 14 03:30:17 2006
@@ -22,6 +22,7 @@
import org.codehaus.plexus.util.cli.CommandLineUtils;
import org.codehaus.plexus.util.cli.Commandline;
import org.codehaus.plexus.util.cli.StreamConsumer;
+import org.apache.maven.plugins.release.ReleaseResult;
import java.io.File;
@@ -43,7 +44,7 @@
* @noinspection UseOfSystemOutOrSystemErr
*/
public void executeGoals( File workingDirectory, String goals, boolean interactive,
- String additionalArguments, String pomFileName )
+ String additionalArguments, String pomFileName, ReleaseResult relResult )
throws MavenExecutorException
{
Commandline cl = commandLineFactory.createCommandLine( "mvn" );
@@ -86,6 +87,7 @@
try
{
+ relResult.appendInfo( "Executing: " + cl.toString() );
getLogger().info( "Executing: " + cl.toString() );
int result = CommandLineUtils.executeCommandLine( cl, stdOut, stdErr );
@@ -100,13 +102,17 @@
{
throw new MavenExecutorException( "Can't run goal " + goals, stdOut.toString(), stdErr.toString(), e );
}
+ finally
+ {
+ relResult.appendOutput( stdOut.toString() );
+ }
}
public void executeGoals( File workingDirectory, String goals, boolean interactive,
- String arguments )
+ String arguments, ReleaseResult result )
throws MavenExecutorException
{
- executeGoals( workingDirectory, goals, interactive, arguments, null );
+ executeGoals( workingDirectory, goals, interactive, arguments, null, result );
}
public void setCommandLineFactory( CommandLineFactory commandLineFactory )
Modified: maven/continuum/branches/release-integration/maven/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/exec/MavenExecutor.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/release-integration/maven/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/exec/MavenExecutor.java?view=diff&rev=443305&r1=443304&r2=443305
==============================================================================
--- maven/continuum/branches/release-integration/maven/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/exec/MavenExecutor.java (original)
+++ maven/continuum/branches/release-integration/maven/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/exec/MavenExecutor.java Thu Sep 14 03:30:17 2006
@@ -16,6 +16,8 @@
* limitations under the License.
*/
+import org.apache.maven.plugins.release.ReleaseResult;
+
import java.io.File;
/**
@@ -41,7 +43,7 @@
* @throws MavenExecutorException if an error occurred executing Maven
*/
void executeGoals( File workingDirectory, String goals, boolean interactive,
- String additionalArguments, String pomFileName )
+ String additionalArguments, String pomFileName, ReleaseResult result )
throws MavenExecutorException;
/**
@@ -54,6 +56,6 @@
* @throws MavenExecutorException if an error occurred executing Maven
*/
void executeGoals( File workingDirectory, String goals, boolean interactive,
- String additionalArguments )
+ String additionalArguments, ReleaseResult result )
throws MavenExecutorException;
}
Modified: maven/continuum/branches/release-integration/maven/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/RunGoalsPhase.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/release-integration/maven/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/RunGoalsPhase.java?view=diff&rev=443305&r1=443304&r2=443305
==============================================================================
--- maven/continuum/branches/release-integration/maven/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/RunGoalsPhase.java (original)
+++ maven/continuum/branches/release-integration/maven/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/RunGoalsPhase.java Thu Sep 14 03:30:17 2006
@@ -54,7 +54,7 @@
mavenExecutor.executeGoals( new File( releaseDescriptor.getWorkingDirectory() ), goals,
releaseDescriptor.isInteractive(),
- releaseDescriptor.getAdditionalArguments() );
+ releaseDescriptor.getAdditionalArguments(), result );
}
}
catch ( MavenExecutorException e )
Modified: maven/continuum/branches/release-integration/maven/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/DefaultReleaseManagerTest.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/release-integration/maven/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/DefaultReleaseManagerTest.java?view=diff&rev=443305&r1=443304&r2=443305
==============================================================================
--- maven/continuum/branches/release-integration/maven/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/DefaultReleaseManagerTest.java (original)
+++ maven/continuum/branches/release-integration/maven/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/DefaultReleaseManagerTest.java Thu Sep 14 03:30:17 2006
@@ -391,7 +391,7 @@
Mock mock = new Mock( MavenExecutor.class );
Constraint[] constraints = new Constraint[]{new IsSame( checkoutDirectory ), new IsEqual( "goal1 goal2" ),
- new IsEqual( Boolean.TRUE ), new IsEqual( "-DperformRelease=true" ), new IsNull()};
+ new IsEqual( Boolean.TRUE ), new IsEqual( "-DperformRelease=true" ), new IsNull(), new IsAnything() };
mock.expects( new InvokeOnceMatcher() ).method( "executeGoals" ).with( constraints );
releaseManager.setMavenExecutor( (MavenExecutor) mock.proxy() );
@@ -420,7 +420,7 @@
Mock mock = new Mock( MavenExecutor.class );
Constraint[] constraints = new Constraint[]{new IsSame( checkoutDirectory ), new IsEqual( "goal1 goal2" ),
- new IsEqual( Boolean.TRUE ), new IsNull(), new IsNull()};
+ new IsEqual( Boolean.TRUE ), new IsNull(), new IsNull(), new IsAnything() };
mock.expects( new InvokeOnceMatcher() ).method( "executeGoals" ).with( constraints );
releaseManager.setMavenExecutor( (MavenExecutor) mock.proxy() );
@@ -450,7 +450,8 @@
Mock mock = new Mock( MavenExecutor.class );
Constraint[] constraints = new Constraint[]{new IsSame( checkoutDirectory ), new IsEqual( "goal1 goal2" ),
- new IsEqual( Boolean.TRUE ), new IsEqual( "-Dmaven.test.skip=true -DperformRelease=true" ), new IsNull()};
+ new IsEqual( Boolean.TRUE ), new IsEqual( "-Dmaven.test.skip=true -DperformRelease=true" ), new IsNull(),
+ new IsAnything() };
mock.expects( new InvokeOnceMatcher() ).method( "executeGoals" ).with( constraints );
releaseManager.setMavenExecutor( (MavenExecutor) mock.proxy() );
@@ -480,7 +481,7 @@
Mock mock = new Mock( MavenExecutor.class );
Constraint[] constraints = new Constraint[]{new IsSame( checkoutDirectory ), new IsEqual( "goal1 goal2" ),
- new IsEqual( Boolean.TRUE ), new IsEqual( "-Dmaven.test.skip=true" ), new IsNull()};
+ new IsEqual( Boolean.TRUE ), new IsEqual( "-Dmaven.test.skip=true" ), new IsNull(), new IsAnything() };
mock.expects( new InvokeOnceMatcher() ).method( "executeGoals" ).with( constraints );
releaseManager.setMavenExecutor( (MavenExecutor) mock.proxy() );
@@ -509,7 +510,7 @@
Mock mock = new Mock( MavenExecutor.class );
Constraint[] constraints = new Constraint[]{new IsSame( checkoutDirectory ), new IsEqual( "goal1 goal2" ),
- new IsEqual( Boolean.TRUE ), new IsEqual( "-DperformRelease=true" ), new IsNull()};
+ new IsEqual( Boolean.TRUE ), new IsEqual( "-DperformRelease=true" ), new IsNull(), new IsAnything() };
mock.expects( new InvokeOnceMatcher() ).method( "executeGoals" ).with( constraints );
releaseManager.setMavenExecutor( (MavenExecutor) mock.proxy() );
@@ -730,7 +731,7 @@
Mock mock = new Mock( MavenExecutor.class );
Constraint[] constraints = new Constraint[]{new IsSame( checkoutDirectory ), new IsEqual( "goal1 goal2" ),
- new IsEqual( Boolean.TRUE ), new IsEqual( "-DperformRelease=true" ), new IsNull()};
+ new IsEqual( Boolean.TRUE ), new IsEqual( "-DperformRelease=true" ), new IsNull(), new IsAnything() };
mock.expects( new InvokeOnceMatcher() ).method( "executeGoals" ).with( constraints ).will(
new ThrowStub( new MavenExecutorException( "...", 1, "stdOut", "stdErr" ) ) );
releaseManager.setMavenExecutor( (MavenExecutor) mock.proxy() );
Modified: maven/continuum/branches/release-integration/maven/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/exec/ForkedMavenExecutorTest.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/release-integration/maven/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/exec/ForkedMavenExecutorTest.java?view=diff&rev=443305&r1=443304&r2=443305
==============================================================================
--- maven/continuum/branches/release-integration/maven/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/exec/ForkedMavenExecutorTest.java (original)
+++ maven/continuum/branches/release-integration/maven/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/exec/ForkedMavenExecutorTest.java Thu Sep 14 03:30:17 2006
@@ -25,6 +25,7 @@
import org.jmock.core.matcher.InvokeOnceMatcher;
import org.jmock.core.stub.ReturnStub;
import org.jmock.core.stub.ThrowStub;
+import org.apache.maven.plugins.release.ReleaseResult;
import java.io.File;
@@ -63,7 +64,7 @@
executor.setCommandLineFactory( (CommandLineFactory) mock.proxy() );
- executor.executeGoals( workingDirectory, "clean integration-test", false, null );
+ executor.executeGoals( workingDirectory, "clean integration-test", false, null, new ReleaseResult() );
assertTrue( true );
}
@@ -89,7 +90,7 @@
executor.setCommandLineFactory( (CommandLineFactory) mock.proxy() );
- executor.executeGoals( workingDirectory, "clean integration-test", false, null, "my-pom.xml" );
+ executor.executeGoals( workingDirectory, "clean integration-test", false, null, "my-pom.xml", new ReleaseResult() );
assertTrue( true );
}
@@ -140,7 +141,7 @@
try
{
- executor.executeGoals( workingDirectory, "clean integration-test", false, null );
+ executor.executeGoals( workingDirectory, "clean integration-test", false, null, new ReleaseResult() );
fail( "Should have thrown an exception" );
}
@@ -174,7 +175,7 @@
try
{
- executor.executeGoals( workingDirectory, "clean integration-test", false, null );
+ executor.executeGoals( workingDirectory, "clean integration-test", false, null, new ReleaseResult() );
fail( "Should have thrown an exception" );
}
Modified: maven/continuum/branches/release-integration/maven/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/RunGoalsPhaseTest.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/release-integration/maven/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/RunGoalsPhaseTest.java?view=diff&rev=443305&r1=443304&r2=443305
==============================================================================
--- maven/continuum/branches/release-integration/maven/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/RunGoalsPhaseTest.java (original)
+++ maven/continuum/branches/release-integration/maven/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/phase/RunGoalsPhaseTest.java Thu Sep 14 03:30:17 2006
@@ -24,9 +24,11 @@
import org.jmock.Mock;
import org.jmock.core.constraint.IsEqual;
import org.jmock.core.constraint.IsNull;
+import org.jmock.core.constraint.IsAnything;
import org.jmock.core.matcher.InvokeOnceMatcher;
import org.jmock.core.matcher.TestFailureMatcher;
import org.jmock.core.stub.ThrowStub;
+import org.jmock.core.Constraint;
import java.io.File;
@@ -58,10 +60,13 @@
config.setWorkingDirectory( testFile.getAbsolutePath() );
Mock mock = new Mock( MavenExecutor.class );
- mock.expects( new InvokeOnceMatcher() ).method( "executeGoals" ).with( new IsEqual( testFile ),
- new IsEqual( "clean integration-test" ),
- new IsEqual( Boolean.TRUE ),
- new IsNull() );
+ Constraint[] constraints = new Constraint[]{ new IsEqual( testFile ),
+ new IsEqual( "clean integration-test" ),
+ new IsEqual( Boolean.TRUE ),
+ new IsNull(),
+ new IsAnything() };
+
+ mock.expects( new InvokeOnceMatcher() ).method( "executeGoals" ).with( constraints );
phase.setMavenExecutor( (MavenExecutor) mock.proxy() );
@@ -81,10 +86,12 @@
config.setWorkingDirectory( testFile.getAbsolutePath() );
Mock mock = new Mock( MavenExecutor.class );
- mock.expects( new InvokeOnceMatcher() ).method( "executeGoals" ).with( new IsEqual( testFile ),
- new IsEqual( "clean integration-test" ),
- new IsEqual( Boolean.TRUE ),
- new IsNull() );
+ Constraint[] constraints = new Constraint[]{new IsEqual( testFile ),
+ new IsEqual( "clean integration-test" ),
+ new IsEqual( Boolean.TRUE ),
+ new IsNull(),
+ new IsAnything() };
+ mock.expects( new InvokeOnceMatcher() ).method( "executeGoals" ).with( constraints );
phase.setMavenExecutor( (MavenExecutor) mock.proxy() );
@@ -103,10 +110,12 @@
config.setWorkingDirectory( testFile.getAbsolutePath() );
Mock mock = new Mock( MavenExecutor.class );
- mock.expects( new InvokeOnceMatcher() ).method( "executeGoals" ).with( new IsEqual( testFile ),
- new IsEqual( "clean integration-test" ),
- new IsEqual( Boolean.TRUE ),
- new IsNull() ).will(
+ Constraint[] constraints = new Constraint[]{ new IsEqual( testFile ),
+ new IsEqual( "clean integration-test" ),
+ new IsEqual( Boolean.TRUE ),
+ new IsNull(),
+ new IsAnything() };
+ mock.expects( new InvokeOnceMatcher() ).method( "executeGoals" ).with( constraints ).will(
new ThrowStub( new MavenExecutorException( "...", new Exception() ) ) );
phase.setMavenExecutor( (MavenExecutor) mock.proxy() );
@@ -132,10 +141,12 @@
config.setWorkingDirectory( testFile.getAbsolutePath() );
Mock mock = new Mock( MavenExecutor.class );
- mock.expects( new InvokeOnceMatcher() ).method( "executeGoals" ).with( new IsEqual( testFile ),
- new IsEqual( "clean integration-test" ),
- new IsEqual( Boolean.TRUE ),
- new IsNull() ).will(
+ Constraint[] constraints = new Constraint[]{ new IsEqual( testFile ),
+ new IsEqual( "clean integration-test" ),
+ new IsEqual( Boolean.TRUE ),
+ new IsNull(),
+ new IsAnything() };
+ mock.expects( new InvokeOnceMatcher() ).method( "executeGoals" ).with( constraints ).will(
new ThrowStub( new MavenExecutorException( "...", new Exception() ) ) );
phase.setMavenExecutor( (MavenExecutor) mock.proxy() );