o Fixed SCM processing

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@756959 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-03-21 15:47:19 +00:00
parent 5ad39cbf47
commit c6a9c40b9d
3 changed files with 42 additions and 4 deletions

View File

@ -35,9 +35,10 @@ public class ScmProcessor extends BaseProcessor
t.setScm( new Scm() );
}
copy( ((p != null) ? p.getScm() : null), c.getScm(), t.getScm(), c.getArtifactId());
copyUrl( ((p != null) ? p.getScm() : null), c.getScm(), t.getScm(), c.getArtifactId());
copyConnection( ((p != null) ? p.getScm() : null), c.getScm(), t.getScm(), c.getArtifactId());
copyDeveloperConnection( ((p != null) ? p.getScm() : null), c.getScm(), t.getScm(), c.getArtifactId());
copyTag( ( ( p != null ) ? p.getScm() : null ), c.getScm(), t.getScm() );
/*
if(c.getLicenses().isEmpty() && p != null)
{
@ -66,7 +67,7 @@ public class ScmProcessor extends BaseProcessor
*/
}
private static void copy(Scm p, Scm c, Scm t, String artifactId )
private static void copyUrl(Scm p, Scm c, Scm t, String artifactId )
{
if(c != null && c.getUrl() != null)
{
@ -110,4 +111,17 @@ public class ScmProcessor extends BaseProcessor
t.setDeveloperConnection( t.getDeveloperConnection() + "/" + artifactId );
}
}
private static void copyTag( Scm p, Scm c, Scm t )
{
if ( c != null && c.getTag() != null )
{
t.setTag( c.getTag() );
}
else if ( p != null && p.getTag() != null )
{
t.setTag( p.getTag() );
}
}
}

View File

@ -985,11 +985,35 @@ public class PomConstructionTest
assertEquals( "project-org", pom.getValue( "organization/name" ) );
assertEquals( "http://project-org.url/", pom.getValue( "organization/url" ) );
assertEquals( 1, ((List<?>)pom.getValue( "licenses" )).size() );
assertEquals( 1, ( (List<?>) pom.getValue( "licenses" ) ).size() );
assertEquals( "project-license", pom.getValue( "licenses[1]/name" ) );
assertEquals( "http://project.url/license", pom.getValue( "licenses[1]/url" ) );
assertEquals( "repo", pom.getValue( "licenses[1]/distribution" ) );
assertEquals( "free", pom.getValue( "licenses[1]/comments" ) );
/* FIXME
assertEquals( 1, ((List<?>)pom.getValue( "developers" )).size() );
assertEquals( 1, ((List<?>)pom.getValue( "contributors" )).size() );
//*/
assertEquals( 1, ( (List<?>) pom.getValue( "mailingLists" ) ).size() );
assertEquals( "project-mailing-list", pom.getValue( "mailingLists[1]/name" ) );
assertEquals( "subscribe@", pom.getValue( "mailingLists[1]/subscribe" ) );
assertEquals( "unsubscribe@", pom.getValue( "mailingLists[1]/unsubscribe" ) );
assertEquals( "post@", pom.getValue( "mailingLists[1]/post" ) );
assertEquals( "mail-archive", pom.getValue( "mailingLists[1]/archive" ) );
assertEquals( 1, ( (List<?>) pom.getValue( "mailingLists[1]/otherArchives" ) ).size() );
assertEquals( "other-archive", pom.getValue( "mailingLists[1]/otherArchives[1]" ) );
/* FIXME
assertEquals( "2.0.1", pom.getValue( "prerequisites/maven" ) );
//*/
assertEquals( "http://project.url/trunk", pom.getValue( "scm/url" ) );
assertEquals( "http://project.url/scm", pom.getValue( "scm/connection" ) );
assertEquals( "https://project.url/scm", pom.getValue( "scm/developerConnection" ) );
assertEquals( "TAG", pom.getValue( "scm/tag" ) );
}

View File

@ -99,7 +99,7 @@ under the License.
<url>http://project.url/trunk</url>
<connection>http://project.url/scm</connection>
<developerConnection>https://project.url/scm</developerConnection>
<tag>HEAD</tag>
<tag>TAG</tag>
</scm>
<issueManagement>
<system>issues</system>