Author: sisbell
Date: Tue Apr 21 21:09:06 2009
New Revision: 767294

URL: http://svn.apache.org/viewvc?rev=767294&view=rev
Log:
[MNG-0731] - The distribution mng layout element was not being copied in the 
model.

Added:
    
maven/components/trunk/maven-project/src/test/resources-project-builder/distribution-management/
    
maven/components/trunk/maven-project/src/test/resources-project-builder/distribution-management/pom.xml
Modified:
    
maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/processors/DistributionManagementProcessor.java
    
maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java

Modified: 
maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/processors/DistributionManagementProcessor.java
URL: 
http://svn.apache.org/viewvc/maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/processors/DistributionManagementProcessor.java?rev=767294&r1=767293&r2=767294&view=diff
==============================================================================
--- 
maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/processors/DistributionManagementProcessor.java
 (original)
+++ 
maven/components/trunk/maven-model-builder/src/main/java/org/apache/maven/model/processors/DistributionManagementProcessor.java
 Tue Apr 21 21:09:06 2009
@@ -45,12 +45,12 @@
 
         if ( c.getDistributionManagement() != null )
         {
-            copy( c.getDistributionManagement(), 
t.getDistributionManagement(), isChildMostSpecialized,
-                  c.getArtifactId(), p );
             if ( p != null && p.getDistributionManagement() != null )
             {
                 copy( p.getDistributionManagement(), 
t.getDistributionManagement(), false, c.getArtifactId(), p );
-            }
+            }          
+            copy( c.getDistributionManagement(), 
t.getDistributionManagement(), isChildMostSpecialized,
+                  c.getArtifactId(), p );
         }
         else if ( p != null && p.getDistributionManagement() != null )
         {
@@ -66,12 +66,12 @@
     private void copy( DistributionManagement source, DistributionManagement 
target, boolean isChild,
                               String artifactId, Model parent )
     {
-        if ( target.getDownloadUrl() == null )
+        if ( source.getDownloadUrl() != null )
         {
             target.setDownloadUrl( source.getDownloadUrl() );
         }
 
-        if ( target.getRelocation() == null && isChild && 
source.getRelocation() != null )
+        if ( isChild && source.getRelocation() != null )
         {
             Relocation sourceRelocation = source.getRelocation();
             Relocation r = new Relocation();
@@ -82,24 +82,24 @@
             target.setRelocation( r );
         }
 
-        if ( target.getStatus() == null )
+        if ( source.getStatus() != null )
         {
             target.setStatus( source.getStatus() );
         }
 
-        if ( target.getRepository() == null && source.getRepository() != null )
+        if ( source.getRepository() != null )
         {
             target.setRepository( new DeploymentRepository() );
             copyRepository( source.getRepository(), target.getRepository() );
         }
 
-        if ( target.getSnapshotRepository() == null && 
source.getSnapshotRepository() != null )
+        if ( source.getSnapshotRepository() != null )
         {
             target.setSnapshotRepository( new DeploymentRepository() );
             copyRepository( source.getSnapshotRepository(), 
target.getSnapshotRepository() );
         }
 
-        if ( target.getSite() == null && source.getSite() != null )
+        if (  source.getSite() != null )
         {
             target.setSite( new Site() );
             copySite( source.getSite(), target.getSite(), isChild, artifactId, 
parent );
@@ -108,22 +108,22 @@
 
     private void copyRepository( DeploymentRepository source, 
DeploymentRepository target )
     {
-        if ( target.getId() == null )
+        if ( source.getId() != null )
         {
             target.setId( source.getId() );
         }
 
-        if ( target.getLayout() == null )
+        if ( source.getLayout() != null )
         {
             target.setLayout( source.getLayout() );
         }
 
-        if ( target.getUrl() == null )
+        if ( source.getUrl() != null )
         {
                target.setUrl( source.getUrl() );
         }
 
-        if ( target.getName() == null )
+        if ( source.getName() != null )
         {
             target.setName( source.getName() );
         }
@@ -133,12 +133,12 @@
 
     private void copySite( Site source, Site target, boolean isChild, String 
artifactId, Model parent )
     {
-        if ( target.getId() == null )
+        if ( source.getId() != null )
         {
             target.setId( source.getId() );
         }
 
-        if ( target.getName() == null )
+        if ( source.getName() != null )
         {
             target.setName( source.getName() );
         }

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=767294&r1=767293&r2=767294&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
 Tue Apr 21 21:09:06 2009
@@ -1396,6 +1396,13 @@
            assertEquals( 20, ( (List<?>) pom.getValue( 
"build/pluginManagement/plugins" ) ).size() );   
        } 
     
+    public void testDistributionManagement()
+           throws Exception
+       {
+           PomTestWrapper pom = this.buildPom( "distribution-management");
+           assertEquals("legacy", pom.getValue( 
"distributionManagement/repository/layout" ));
+}     
+    
     private void assertPathSuffixEquals( String expected, Object actual )
     {
         String a = actual.toString();

Added: 
maven/components/trunk/maven-project/src/test/resources-project-builder/distribution-management/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/test/resources-project-builder/distribution-management/pom.xml?rev=767294&view=auto
==============================================================================
--- 
maven/components/trunk/maven-project/src/test/resources-project-builder/distribution-management/pom.xml
 (added)
+++ 
maven/components/trunk/maven-project/src/test/resources-project-builder/distribution-management/pom.xml
 Tue Apr 21 21:09:06 2009
@@ -0,0 +1,39 @@
+<?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>
+
+  <groupId>org.apache.maven.its.it0061</groupId>
+  <artifactId>maven-it-it0061</artifactId>
+  <version>1.0</version>
+  <packaging>jar</packaging>
+
+  <name>Maven Integration Test :: it0061</name> 
+
+  <distributionManagement>
+    <repository>
+      <id>test</id>
+      <url>file:target/test-repo</url>
+      <layout>legacy</layout>
+    </repository>
+  </distributionManagement>
+</project>


Reply via email to