mirror of https://github.com/apache/maven.git
Fixed empty scm tag being add to pom.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@759417 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e81caca85f
commit
3cfbbb52c6
|
@ -34,15 +34,21 @@ public class ScmProcessor extends BaseProcessor
|
|||
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 )
|
||||
|
|
|
@ -944,8 +944,15 @@ public class PomConstructionTest
|
|||
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
|
||||
{
|
||||
|
|
|
@ -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>
|
Loading…
Reference in New Issue