Author: brett
Date: Tue May 2 08:16:53 2006
New Revision: 398960
URL: http://svn.apache.org/viewcvs?rev=398960&view=rev
Log:
[MRELEASE-98] clean up some items, add pom execution configurability
Modified:
maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/DefaultReleaseManager.java
maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java
maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/exec/ForkedMavenExecutor.java
maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/exec/MavenExecutor.java
maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/CheckPomPhase.java
maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/ScmCheckModificationsPhase.java
maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/exec/ForkedMavenExecutorTest.java
Modified:
maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/DefaultReleaseManager.java
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/DefaultReleaseManager.java?rev=398960&r1=398959&r2=398960&view=diff
==============================================================================
---
maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/DefaultReleaseManager.java
(original)
+++
maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/DefaultReleaseManager.java
Tue May 2 08:16:53 2006
@@ -206,54 +206,9 @@
throw new ReleaseScmCommandException( "Unable to checkout from
SCM", result );
}
-/* TODO [!]
- if ( StringUtils.isEmpty( releasePom ) )
- {
- File pomFile = project.getFile();
-
- releasePom = pomFile.getName();
- }
-
- if ( releasePom.equals( Maven.RELEASE_POMv4 ) && interactive )
- {
- StringBuffer warning = new StringBuffer();
- warning.append(
"\n*******************************************************************************\n"
);
- warning.append( "\nYou have chosen to use the fully resolved
release-POM to deploy this project." );
- warning.append( "\n" );
- warning.append( "\nNOTE: Deploying artifacts using the fully
resolved release-POM " );
- warning.append( "\nwill result in loss of any version ranges
specified for your" );
- warning.append( "\nproject's dependencies." );
- warning.append( "\n" );
- warning.append( "\nAre you sure you want to do this?" );
- warning.append( "\n" );
- warning.append(
"\n*******************************************************************************\n"
);
-
- getLog().warn( warning );
-
- getLog().info( "Enter the POM filename to use for deployment: [" +
releasePom + "] " );
-
- try
- {
- String input = getInputHandler().readLine();
-
- if ( !StringUtils.isEmpty( input ) )
- {
- releasePom = input;
- }
- }
- catch ( IOException e )
- {
- throw new MojoExecutionException( "An error has occurred while
reading the pom file location.", e );
- }
- }
-
- getLog().info( "Releasing project based on POM: " + releasePom + " in
working directory: " + checkoutDirectory );
-
- cl.createArgument().setLine( "-f " + releasePom );
-*/
try
{
- mavenExecutor.executeGoals( checkoutDirectory, goals,
config.isInteractive(),
+ mavenExecutor.executeGoals( checkoutDirectory, goals,
config.isInteractive(), config.getPomFileName(),
config.getAdditionalArguments() );
}
catch ( MavenExecutorException e )
Modified:
maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java?rev=398960&r1=398959&r2=398960&view=diff
==============================================================================
---
maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java
(original)
+++
maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java
Tue May 2 08:16:53 2006
@@ -105,7 +105,6 @@
config.setUseEditMode( useEditMode );
// TODO [!]: prep goals not configurable
// TODO [!]: resume not configured
- // TODO: move to abstract?
try
{
Modified:
maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/exec/ForkedMavenExecutor.java
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/exec/ForkedMavenExecutor.java?rev=398960&r1=398959&r2=398960&view=diff
==============================================================================
---
maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/exec/ForkedMavenExecutor.java
(original)
+++
maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/exec/ForkedMavenExecutor.java
Tue May 2 08:16:53 2006
@@ -42,7 +42,8 @@
/**
* @noinspection UseOfSystemOutOrSystemErr
*/
- public void executeGoals( File workingDirectory, String goals, boolean
interactive, String arguments )
+ public void executeGoals( File workingDirectory, String goals, boolean
interactive, String pomFileName,
+ String additionalArguments )
throws MavenExecutorException
{
Commandline cl = commandLineFactory.createCommandLine( "mvn" );
@@ -51,6 +52,11 @@
cl.addEnvironment( "MAVEN_TERMINATE_CMD", "on" );
+ if ( pomFileName != null )
+ {
+ cl.createArgument().setLine( "-f " + pomFileName );
+ }
+
if ( goals != null )
{
// accept both space and comma, so the old way still work
@@ -69,9 +75,9 @@
cl.createArgument().setValue( "--batch-mode" );
}
- if ( !StringUtils.isEmpty( arguments ) )
+ if ( !StringUtils.isEmpty( additionalArguments ) )
{
- cl.createArgument().setLine( arguments );
+ cl.createArgument().setLine( additionalArguments );
}
/* TODO [!]
@@ -121,7 +127,7 @@
public void executeGoals( File workingDirectory, String goals, boolean
interactive )
throws MavenExecutorException
{
- executeGoals( workingDirectory, goals, interactive, null );
+ executeGoals( workingDirectory, goals, interactive, null, null );
}
public void setCommandLineFactory( CommandLineFactory commandLineFactory )
Modified:
maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/exec/MavenExecutor.java
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/exec/MavenExecutor.java?rev=398960&r1=398959&r2=398960&view=diff
==============================================================================
---
maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/exec/MavenExecutor.java
(original)
+++
maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/exec/MavenExecutor.java
Tue May 2 08:16:53 2006
@@ -33,13 +33,15 @@
/**
* Execute goals using Maven.
*
- * @param workingDirectory the directory to execute in
- * @param goals the goals to run (space delimited)
- * @param interactive whether to execute in interactive mode, or the
default batch mode
- * @param arguments the arguments to pass to the executable (space
delimited)
+ * @param workingDirectory the directory to execute in
+ * @param goals the goals to run (space delimited)
+ * @param interactive whether to execute in interactive mode, or
the default batch mode
+ * @param pomFileName the file name of the POM to execute on
+ * @param additionalArguments additional arguments to pass to the Maven
command
* @throws MavenExecutorException if an error occurred executing Maven
*/
- void executeGoals( File workingDirectory, String goals, boolean
interactive, String arguments )
+ void executeGoals( File workingDirectory, String goals, boolean
interactive, String pomFileName,
+ String additionalArguments )
throws MavenExecutorException;
/**
Modified:
maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/CheckPomPhase.java
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/CheckPomPhase.java?rev=398960&r1=398959&r2=398960&view=diff
==============================================================================
---
maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/CheckPomPhase.java
(original)
+++
maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/CheckPomPhase.java
Tue May 2 08:16:53 2006
@@ -36,12 +36,27 @@
public void execute( ReleaseConfiguration releaseConfiguration )
throws ReleaseExecutionException
{
- // TODO [!]: SCM URL is coming from the store but it probably needs to
be read from every project instead
- // TODO [!]: prepare release mojo needs to set this correct to either
connection or developerConnection as appropriate - new version doesn't handle it
+ // Currently, we don't deal with multiple SCM locations in a
multiproject
if ( StringUtils.isEmpty( releaseConfiguration.getUrl() ) )
{
- throw new ReleaseExecutionException(
- "Missing required setting: scm connection or
developerConnection must be specified." );
+ MavenProject rootProject = (MavenProject)
releaseConfiguration.getReactorProjects().get( 0 );
+ if ( rootProject != null && rootProject.getScm() != null )
+ {
+ if ( rootProject.getScm().getDeveloperConnection() != null )
+ {
+ releaseConfiguration.setUrl(
rootProject.getScm().getDeveloperConnection() );
+ }
+ else if ( rootProject.getScm().getConnection() != null )
+ {
+ releaseConfiguration.setUrl(
rootProject.getScm().getConnection() );
+ }
+ }
+
+ if ( StringUtils.isEmpty( releaseConfiguration.getUrl() ) )
+ {
+ throw new ReleaseExecutionException(
+ "Missing required setting: scm connection or
developerConnection must be specified." );
+ }
}
List reactorProjects = releaseConfiguration.getReactorProjects();
Modified:
maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/ScmCheckModificationsPhase.java
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/ScmCheckModificationsPhase.java?rev=398960&r1=398959&r2=398960&view=diff
==============================================================================
---
maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/ScmCheckModificationsPhase.java
(original)
+++
maven/plugins/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/phase/ScmCheckModificationsPhase.java
Tue May 2 08:16:53 2006
@@ -54,7 +54,7 @@
/**
* The files to exclude from the status check.
*
- * @todo proper construction of filenames, especially release properties
+ * @todo [!] proper construction of filenames, especially release
properties
*/
private Set excludedFiles = new HashSet( Arrays.asList(
new String[]{"pom.xml", "pom.xml.backup", "pom.xml.tag",
"pom.xml.next", "release.properties"} ) );
Modified:
maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/exec/ForkedMavenExecutorTest.java
URL:
http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/exec/ForkedMavenExecutorTest.java?rev=398960&r1=398959&r2=398960&view=diff
==============================================================================
---
maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/exec/ForkedMavenExecutorTest.java
(original)
+++
maven/plugins/trunk/maven-release-plugin/src/test/java/org/apache/maven/plugins/release/exec/ForkedMavenExecutorTest.java
Tue May 2 08:16:53 2006
@@ -89,7 +89,7 @@
executor.setCommandLineFactory( (CommandLineFactory) mock.proxy() );
- executor.executeGoals( workingDirectory, "clean integration-test",
false, arguments );
+ executor.executeGoals( workingDirectory, "clean integration-test",
false, null, arguments );
assertTrue( true );
}