Resolving: MNG-886

o Added complex test case for the release plugin, called it2002.
o Added copying of reportArtifacts and extensionArtifacts sets when one MavenProject is constructed with another.
o Added some logging statements to PrepareReleaseMojo, which I will remove later when I'm done with this rash of bugfixes.



git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@289294 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2005-09-15 19:21:28 +00:00
parent c9de4b6e9a
commit dca4ae4518
6 changed files with 123 additions and 3 deletions

View File

@ -0,0 +1,64 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.it2002</groupId>
<artifactId>project</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>1.0.2-SNAPSHOT</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>snapshots</id>
<url>http://snapshots.maven.codehaus.org/maven2</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>test</id>
<url>file:../target/test-repo</url>
</repository>
<snapshotRepository>
<id>test-snaps</id>
<url>file:../target/test-repo</url>
</snapshotRepository>
</distributionManagement>
<scm>
<connection>scm:svn:file://${project.file.parentFile.parentFile}/target/svnroot/project/trunk</connection>
<developerConnection>scm:svn:file://${project.file.parentFile.parentFile}/target/svnroot/project/trunk</developerConnection>
<url>file://${project.file.parentFile.parentFile}/target/svnroot/project/trunk</url>
<tag>p1</tag>
</scm>
<properties>
<tagBase>file://${project.file.parentFile.parentFile}/target/svnroot/project/tags</tagBase>
</properties>
<!-- build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.0-beta-1-SNAPSHOT</version>
</plugin>
</plugins>
</build -->
<reporting>
<plugins>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
</plugin>
</plugins>
</reporting>
</project>

View File

@ -0,0 +1,7 @@
package org.apache.maven.it2002;
public class Thing
{
private String type;
}

27
maven-core-it/it2002/test.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/bash
rm -Rf target
rm -Rf project.checkout
mkdir target
svnadmin create --fs-type fsfs target/svnroot
rm -Rf `find project -type d -name .svn`
dir=`readlink -f ${PWD}`
svn import project file://${dir}/target/svnroot/project/trunk -m "import."
svn mkdir file://${dir}/target/svnroot/project/tags -m "Creating tags dir."
svn co file://${dir}/target/svnroot/project/trunk project.checkout
cd project.checkout
rm -Rf target
#. ~/shell-switches/m2-debug-on
#echo "Enabling debugging options. Please attach the debugger."
m2 -e release:prepare

View File

@ -86,6 +86,7 @@ public class PrepareReleaseMojo
/**
* @parameter expression="${settings.interactiveMode}"
* @required
* @readonly
*/
private boolean interactive;
@ -240,7 +241,7 @@ public class PrepareReleaseMojo
}
}
removeReleasePoms();
// removeReleasePoms();
checkInNextSnapshot();
@ -890,12 +891,18 @@ public class PrepareReleaseMojo
{
//Rewrite report version
Map reportArtifacts = releaseProject.getReportArtifactMap();
getLog().info( "Using report-artifact map with " + reportArtifacts.size() + " entries." );
for ( Iterator i = reports.iterator(); i.hasNext(); )
{
ReportPlugin plugin = (ReportPlugin) i.next();
Artifact artifact = (Artifact) reportArtifacts.get( plugin.getKey() );
String pluginKey = plugin.getKey();
getLog().info( "Looking up report artifact for: \'" + pluginKey + "\'" );
Artifact artifact = (Artifact) reportArtifacts.get( pluginKey );
String version = resolveVersion( artifact, "report", releaseProject );
@ -1054,6 +1061,7 @@ public class PrepareReleaseMojo
private String resolveVersion( Artifact artifact, String artifactUsage, MavenProject project )
throws MojoExecutionException
{
getLog().info( "Resolving version for: " + artifact );
String resolvedVersion = getVersionResolver().getResolvedVersion( artifact.getGroupId(),
artifact.getArtifactId() );

View File

@ -156,6 +156,9 @@ public class MavenProject
this.artifacts = Collections.unmodifiableSet( project.artifacts );
}
this.pluginArtifacts = Collections.unmodifiableSet( project.pluginArtifacts );
this.reportArtifacts = Collections.unmodifiableSet( project.reportArtifacts );
this.extensionArtifacts = Collections.unmodifiableSet( project.extensionArtifacts );
this.remoteArtifactRepositories = Collections.unmodifiableList( project.remoteArtifactRepositories );
this.pluginArtifactRepositories = Collections.unmodifiableList( project.pluginArtifactRepositories );
this.collectedProjects = Collections.unmodifiableList( project.collectedProjects );
@ -972,7 +975,7 @@ public class MavenProject
this.artifacts = artifacts;
// flush the calculated artifactMap
artifactMap = null;
this.artifactMap = null;
}
public Set getArtifacts()
@ -993,6 +996,8 @@ public class MavenProject
public void setPluginArtifacts( Set pluginArtifacts )
{
this.pluginArtifacts = pluginArtifacts;
this.pluginArtifactMap = null;
}
public Set getPluginArtifacts()
@ -1013,6 +1018,8 @@ public class MavenProject
public void setReportArtifacts( Set reportArtifacts )
{
this.reportArtifacts = reportArtifacts;
this.reportArtifactMap = null;
}
public Set getReportArtifacts()
@ -1033,6 +1040,8 @@ public class MavenProject
public void setExtensionArtifacts( Set extensionArtifacts )
{
this.extensionArtifacts = extensionArtifacts;
this.extensionArtifactMap = null;
}
public Set getExtensionArtifacts()

View File

@ -203,6 +203,11 @@
<codeSegment>
<version>1.0.0</version>
<code><![CDATA[
public Boolean getInteractiveMode()
{
return Boolean.valueOf( isInteractiveMode() );
}
private Proxy activeProxy;
public void flushActiveProxy()