Fixing problem where release:prepare was only going to add the top-level release-pom.xml...

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@227234 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2005-08-03 16:57:54 +00:00
parent 4f34ea4f93
commit 25f83d1033
1 changed files with 151 additions and 141 deletions

View File

@ -37,7 +37,6 @@ import org.apache.maven.plugins.release.helpers.ScmHelper;
import org.apache.maven.project.MavenProject;
import org.apache.maven.scm.ScmException;
import org.apache.maven.scm.ScmFile;
import org.apache.maven.scm.ScmFileStatus;
import org.codehaus.plexus.components.inputhandler.InputHandler;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.StringUtils;
@ -187,9 +186,10 @@ public class PrepareReleaseMojo
transformPomToReleaseVersionPom( project );
generateReleasePom( project );
}
generateReleasePoms();
checkInRelease();
tagRelease();
@ -749,11 +749,26 @@ public class PrepareReleaseMojo
}
}
private void generateReleasePom( MavenProject project )
private void generateReleasePoms()
throws MojoExecutionException
{
if ( !getReleaseProgress().verifyCheckpoint( ReleaseProgressTracker.CP_GENERATED_RELEASE_POM ) )
{
String canonicalBasedir;
try
{
canonicalBasedir = trimPathForScmCalculation( new File( basedir ) );
}
catch ( IOException e )
{
throw new MojoExecutionException( "Cannot canonicalize basedir: " + basedir, e );
}
for ( Iterator it = reactorProjects.iterator(); it.hasNext(); )
{
MavenProject project = (MavenProject) it.next();
MavenProject releaseProject = new MavenProject( project );
Model releaseModel = releaseProject.getModel();
@ -876,29 +891,23 @@ public class PrepareReleaseMojo
try
{
String releasePomPath = trimPathForScmCalculation( releasePomFile );
releasePomPath = releasePomPath.substring( canonicalBasedir.length() );
ScmHelper scm = getScm();
scm.setWorkingDirectory( basedir );
List scmChanges = scm.getStatus();
for ( Iterator i = scmChanges.iterator(); i.hasNext(); )
{
ScmFile f = (ScmFile) i.next();
if ( f.getPath().equals( "release-pom.xml" ) && f.getStatus() != ScmFileStatus.MODIFIED )
{
getScm().add( RELEASE_POM );
}
}
scm.add( releasePomPath );
}
catch ( ScmException e )
{
throw new MojoExecutionException( "Error updating the release-pom.xml.", e );
throw new MojoExecutionException( "Error adding the release-pom.xml: " + releasePomFile, e );
}
catch ( IOException e )
{
throw new MojoExecutionException( "Error updating the release-pom.xml.", e );
throw new MojoExecutionException( "Error adding the release-pom.xml: " + releasePomFile, e );
}
try
@ -911,6 +920,7 @@ public class PrepareReleaseMojo
}
}
}
}
private String resolveVersion( Artifact artifact, String artifactUsage, MavenProject project )
throws MojoExecutionException