mirror of https://github.com/apache/maven.git
more fixes to the release plugin
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@279328 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7d198eb4ad
commit
7b6f292c73
|
@ -74,6 +74,8 @@ public class PrepareReleaseMojo
|
|||
|
||||
private static final String RELEASE_POM = "release-pom.xml";
|
||||
|
||||
private static final String POM = "pom.xml";
|
||||
|
||||
/**
|
||||
* @parameter expression="${basedir}"
|
||||
* @required
|
||||
|
@ -255,12 +257,6 @@ public class PrepareReleaseMojo
|
|||
private void transformPomToSnapshotVersionPom( MavenProject project )
|
||||
throws MojoExecutionException
|
||||
{
|
||||
if ( isSnapshot( project.getVersion() ) )
|
||||
{
|
||||
throw new MojoExecutionException( "This project is a snapshot (" + project.getVersion() +
|
||||
"). It appears that the release version has not been committed." );
|
||||
}
|
||||
|
||||
Model model = project.getOriginalModel();
|
||||
|
||||
ProjectVersionResolver versionResolver = getVersionResolver();
|
||||
|
@ -361,15 +357,17 @@ public class PrepareReleaseMojo
|
|||
}
|
||||
Writer writer = null;
|
||||
|
||||
File file = new File( project.getFile().getParentFile(), POM );
|
||||
|
||||
try
|
||||
{
|
||||
writer = new FileWriter( project.getFile() );
|
||||
writer = new FileWriter( file );
|
||||
|
||||
project.writeOriginalModel( writer );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new MojoExecutionException( "Cannot write development version of pom to: " + project.getFile(), e );
|
||||
throw new MojoExecutionException( "Cannot write development version of pom to: " + file, e );
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -777,15 +775,16 @@ public class PrepareReleaseMojo
|
|||
|
||||
Writer writer = null;
|
||||
|
||||
File file = new File( project.getFile().getParentFile(), POM );
|
||||
try
|
||||
{
|
||||
writer = new FileWriter( project.getFile() );
|
||||
writer = new FileWriter( file );
|
||||
|
||||
project.writeOriginalModel( writer );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new MojoExecutionException( "Cannot write released version of pom to: " + project.getFile(), e );
|
||||
throw new MojoExecutionException( "Cannot write released version of pom to: " + file, e );
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
|
@ -86,6 +86,13 @@ public class ProjectVersionResolver
|
|||
{
|
||||
String projectVersion = project.getOriginalModel().getVersion();
|
||||
|
||||
if ( project.getVersion().endsWith( "SNAPSHOT" ) )
|
||||
{
|
||||
String projectId = ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() );
|
||||
throw new MojoExecutionException( "The project " + projectId + " is a snapshot (" + project.getVersion() +
|
||||
"). It appears that the release version has not been committed." );
|
||||
}
|
||||
|
||||
// TODO: we will need to incorporate versioning strategies here because it is unlikely
|
||||
// that everyone will be able to agree on a standard. This is extremely limited right
|
||||
// now and really only works for the way maven is versioned.
|
||||
|
|
Loading…
Reference in New Issue