Author: jvanzyl Date: Sat May 21 10:50:01 2005 New Revision: 171233 URL: http://svn.apache.org/viewcvs?rev=171233&view=rev Log: o use the parent of the current project not the project we started with :-)
Modified: maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/release/PrepareReleaseMojo.java Modified: maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/release/PrepareReleaseMojo.java URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/release/PrepareReleaseMojo.java?rev=171233&r1=171232&r2=171233&view=diff ============================================================================== --- maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/release/PrepareReleaseMojo.java (original) +++ maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/release/PrepareReleaseMojo.java Sat May 21 10:50:01 2005 @@ -69,7 +69,7 @@ protected void executeTask() throws MojoExecutionException { - checkStatus(); + //checkStatus(); checkDependencies(); @@ -88,13 +88,16 @@ private void checkStatus() throws MojoExecutionException { - getLog().info( "Verifying no modifications are present." ); + getLog().info( "Verifying there are no local modifications ..." ); List changedFiles; + try { ScmBean scm = getScm(); + scm.setWorkingDirectory( basedir ); + changedFiles = scm.getStatus(); } catch ( ScmException e ) @@ -105,13 +108,17 @@ if ( !changedFiles.isEmpty() ) { StringBuffer message = new StringBuffer(); + for ( Iterator i = changedFiles.iterator(); i.hasNext(); ) { ScmFile file = (ScmFile) i.next(); + message.append( file.toString() ); + message.append( "\n" ); } - throw new MojoExecutionException( "Cannot prepare a release - You have some uncommitted files : \n" + message.toString() ); + + throw new MojoExecutionException( "Cannot prepare the release because you have local modifications : \n" + message.toString() ); } } @@ -119,8 +126,13 @@ throws MojoExecutionException { MavenProject currentProject = project; + + getLog().info( "Checking lineage ..." ); + while ( currentProject.hasParent() ) { + System.out.println( "currentProject = " + currentProject ); + Artifact parentArtifact = currentProject.getParentArtifact(); if ( isSnapshot( parentArtifact.getVersion() ) ) @@ -128,42 +140,60 @@ throw new MojoExecutionException( "Can't release project due to non released parent." ); } - currentProject = project.getParent(); + currentProject = currentProject.getParent(); } + getLog().info( "Checking dependencies ..." ); + List snapshotDependencies = new ArrayList(); for ( Iterator i = project.getArtifacts().iterator(); i.hasNext(); ) { Artifact artifact = (Artifact) i.next(); + if ( isSnapshot( artifact.getVersion() ) ) { snapshotDependencies.add( artifact ); } } + + getLog().info( "Checking plugins ..." ); + for ( Iterator i = project.getPluginArtifacts().iterator(); i.hasNext(); ) { Artifact artifact = (Artifact) i.next(); + if ( isSnapshot( artifact.getVersion() ) ) { snapshotDependencies.add( artifact ); } } + if ( !snapshotDependencies.isEmpty() ) { Collections.sort( snapshotDependencies ); + StringBuffer message = new StringBuffer(); + for ( Iterator i = snapshotDependencies.iterator(); i.hasNext(); ) { Artifact artifact = (Artifact) i.next(); + message.append( " " ); + message.append( artifact.getGroupId() ); + message.append( ":" ); + message.append( artifact.getArtifactId() ); + message.append( ":" ); + message.append( artifact.getVersion() ); + message.append( "\n" ); } + throw new MojoExecutionException( "Can't release project due to non released dependencies :\n" + message.toString() ); } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]