You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jd...@apache.org on 2005/09/15 22:40:49 UTC
svn commit: r289311 - in /maven/components/trunk:
maven-artifact/src/main/java/org/apache/maven/artifact/ArtifactUtils.java
maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java
Author: jdcasey
Date: Thu Sep 15 13:40:43 2005
New Revision: 289311
URL: http://svn.apache.org/viewcvs?rev=289311&view=rev
Log:
Resolving: MNG-879. Now, all isSnapshot() stuff for the release plugin is handled by ArtifactUtils, so it's possible to reuse the logic rather than replicate it.
Modified:
maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/ArtifactUtils.java
maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java
Modified: maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/ArtifactUtils.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/ArtifactUtils.java?rev=289311&r1=289310&r2=289311&view=diff
==============================================================================
--- maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/ArtifactUtils.java (original)
+++ maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/ArtifactUtils.java Thu Sep 15 13:40:43 2005
@@ -28,6 +28,11 @@
{
}
+ public static boolean isSnapshot( String version )
+ {
+ return version != null && Artifact.VERSION_FILE_PATTERN.matcher( version ).matches();
+ }
+
public static String versionlessKey( Artifact artifact )
{
return versionlessKey( artifact.getGroupId(), artifact.getArtifactId() );
Modified: maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java?rev=289311&r1=289310&r2=289311&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java (original)
+++ maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java Thu Sep 15 13:40:43 2005
@@ -71,8 +71,6 @@
public class PrepareReleaseMojo
extends AbstractReleaseMojo
{
- private static final String SNAPSHOT = "-SNAPSHOT";
-
private static final String RELEASE_POM = "release-pom.xml";
private static final String POM = "pom.xml";
@@ -241,6 +239,7 @@
}
}
+ //TODO reinstate.
// removeReleasePoms();
checkInNextSnapshot();
@@ -458,11 +457,6 @@
return scmRewriter;
}
- private boolean isSnapshot( String version )
- {
- return version.endsWith( SNAPSHOT );
- }
-
private void checkForLocalModifications()
throws MojoExecutionException
{
@@ -544,7 +538,7 @@
String parentVersion = null;
- if ( isSnapshot( parentProject.getVersion() ) )
+ if ( ArtifactUtils.isSnapshot( parentProject.getVersion() ) )
{
parentVersion = getVersionResolver().getResolvedVersion( parentProject.getGroupId(),
parentProject.getArtifactId() );
@@ -554,7 +548,7 @@
parentVersion = parentProject.getVersion();
}
- if ( isSnapshot( parentVersion ) )
+ if ( ArtifactUtils.isSnapshot( parentVersion ) )
{
throw new MojoExecutionException( "Can't release project due to non released parent (" +
parentProject.getGroupId() + ":" + parentProject.getArtifactId() + parentVersion + "." );
@@ -580,7 +574,7 @@
artifactVersion = artifact.getVersion();
}
- if ( isSnapshot( artifactVersion ) )
+ if ( ArtifactUtils.isSnapshot( artifactVersion ) )
{
snapshotDependencies.add( artifact );
}
@@ -600,7 +594,7 @@
artifactVersion = artifact.getVersion();
}
- if ( isSnapshot( artifactVersion ) )
+ if ( ArtifactUtils.isSnapshot( artifactVersion ) )
{
snapshotDependencies.add( artifact );
}
@@ -633,7 +627,7 @@
private void transformPomToReleaseVersionPom( MavenProject project )
throws MojoExecutionException
{
- if ( !isSnapshot( project.getVersion() ) )
+ if ( !ArtifactUtils.isSnapshot( project.getVersion() ) )
{
throw new MojoExecutionException( "The project " + project.getGroupId() + ":" + project.getArtifactId() +
" isn't a snapshot (" + project.getVersion() + ")." );
@@ -646,7 +640,7 @@
{
Artifact parentArtifact = project.getParentArtifact();
- if ( isSnapshot( parentArtifact.getBaseVersion() ) )
+ if ( ArtifactUtils.isSnapshot( parentArtifact.getBaseVersion() ) )
{
String version = resolveVersion( parentArtifact, "parent", project );
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org