Author: sisbell Date: Sat Mar 28 02:01:18 2009 New Revision: 759417 URL: http://svn.apache.org/viewvc?rev=759417&view=rev Log: Fixed empty scm tag being add to pom.
Added: maven/components/trunk/maven-project/src/test/resources-project-builder/empty-scm/ maven/components/trunk/maven-project/src/test/resources-project-builder/empty-scm/pom.xml Modified: maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/processor/ScmProcessor.java maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java Modified: maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/processor/ScmProcessor.java URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/processor/ScmProcessor.java?rev=759417&r1=759416&r2=759417&view=diff ============================================================================== --- maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/processor/ScmProcessor.java (original) +++ maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/processor/ScmProcessor.java Sat Mar 28 02:01:18 2009 @@ -34,15 +34,21 @@ Model t = (Model) target; Model c = (Model) child; Model p = (Model) parent; - if(t.getScm() == null) + if((p == null || p.getScm() == null) && (c == null || c.getScm() == null)) { - t.setScm( new Scm() ); + //return; } + Scm targetScm = (t.getScm() == null) ? new Scm() : t.getScm(); + + copyUrl( ((p != null) ? p.getScm() : null), c.getScm(), targetScm, c.getArtifactId(), p); + copyConnection( ((p != null) ? p.getScm() : null), c.getScm(), targetScm, c.getArtifactId(), p); + copyDeveloperConnection( ((p != null) ? p.getScm() : null), c.getScm(), targetScm, c.getArtifactId(), p); + copyTag( ( ( p != null ) ? p.getScm() : null ), c.getScm(), targetScm ); - copyUrl( ((p != null) ? p.getScm() : null), c.getScm(), t.getScm(), c.getArtifactId(), p); - copyConnection( ((p != null) ? p.getScm() : null), c.getScm(), t.getScm(), c.getArtifactId(), p); - copyDeveloperConnection( ((p != null) ? p.getScm() : null), c.getScm(), t.getScm(), c.getArtifactId(), p); - copyTag( ( ( p != null ) ? p.getScm() : null ), c.getScm(), t.getScm() ); + if(t.getScm() ==null && (targetScm.getConnection() !=null || targetScm.getDeveloperConnection() != null || targetScm.getUrl() != null)) + { + t.setScm(targetScm); + } } private void copyUrl(Scm p, Scm c, Scm t, String artifactId, Model parent ) Modified: maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java?rev=759417&r1=759416&r2=759417&view=diff ============================================================================== --- maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java (original) +++ maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java Sat Mar 28 02:01:18 2009 @@ -944,8 +944,15 @@ PomTestWrapper pom = this.buildPom( "repo-inheritance" ); assertEquals(1, ( (List<?>) pom.getValue( "repositories" ) ).size()); assertEquals( "it0043", pom.getValue( "repositories[1]/name" ) ); - } - + } + + public void testEmptyScm() + throws Exception + { + PomTestWrapper pom = this.buildPom( "empty-scm" ); + assertNull(pom.getValue( "scm" )); + } + public void testPluginConfigurationUsingAttributesWithoutPluginManagement() throws Exception { Added: maven/components/trunk/maven-project/src/test/resources-project-builder/empty-scm/pom.xml URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/test/resources-project-builder/empty-scm/pom.xml?rev=759417&view=auto ============================================================================== --- maven/components/trunk/maven-project/src/test/resources-project-builder/empty-scm/pom.xml (added) +++ maven/components/trunk/maven-project/src/test/resources-project-builder/empty-scm/pom.xml Sat Mar 28 02:01:18 2009 @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<project> + <modelVersion>4.0.0</modelVersion> + + <!-- + This (almost) minimal POM tests direct inheritance from the super POM. + --> + + <groupId>org.apache.maven.its.mng3843</groupId> + <artifactId>test-1</artifactId> + <version>0.1</version> + + <name>test</name> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.its.plugins</groupId> + <artifactId>maven-it-plugin-expression</artifactId> + <version>2.1-SNAPSHOT</version> + <executions> + <execution> + <phase>validate</phase> + <goals> + <goal>eval</goal> + </goals> + <configuration> + <outputFile>target/pom.properties</outputFile> + <expressions> + <expression>project</expression> + </expressions> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project>