Author: sisbell
Date: Fri Mar 27 16:15:25 2009
New Revision: 759192

URL: http://svn.apache.org/viewvc?rev=759192&view=rev
Log:
[MNG-3621] -site url inheritance broken for UNC paths

Added:
    
maven/components/trunk/maven-project/src/test/resources-project-builder/unc-path/
    
maven/components/trunk/maven-project/src/test/resources-project-builder/unc-path/pom.xml
    
maven/components/trunk/maven-project/src/test/resources-project-builder/unc-path/sub/
    
maven/components/trunk/maven-project/src/test/resources-project-builder/unc-path/sub/pom.xml
Modified:
    
maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/processor/DistributionManagementProcessor.java
    
maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/DefaultProfileManager.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/DistributionManagementProcessor.java
URL: 
http://svn.apache.org/viewvc/maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/processor/DistributionManagementProcessor.java?rev=759192&r1=759191&r2=759192&view=diff
==============================================================================
--- 
maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/processor/DistributionManagementProcessor.java
 (original)
+++ 
maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/processor/DistributionManagementProcessor.java
 Fri Mar 27 16:15:25 2009
@@ -152,12 +152,12 @@
 
             else
             {
-                target.setUrl( source.getUrl() + "/" + artifactId );
+                target.setUrl( source.getUrl() + 
(source.getUrl().endsWith("/")  ? "" : "/") + artifactId );
             }
         }
         else 
         {
-            target.setUrl( target.getUrl() + "/" + artifactId );
+            target.setUrl( target.getUrl() + (target.getUrl().endsWith("/")  ? 
"" : "/")+ artifactId );
         }
     }
 

Modified: 
maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java
URL: 
http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java?rev=759192&r1=759191&r2=759192&view=diff
==============================================================================
--- 
maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java
 (original)
+++ 
maven/components/trunk/maven-project/src/main/java/org/apache/maven/profiles/DefaultProfileManager.java
 Fri Mar 27 16:15:25 2009
@@ -132,26 +132,25 @@
 
             String profileId = (String) entry.getKey();
             Profile profile = (Profile) entry.getValue();
-            System.out.println("Profile = " + profileId);
+
             boolean shouldAdd = false;
             if ( profileActivationContext.isExplicitlyActive( profileId ) )
             {
-                System.out.println("AAA: " + profileId);
                 shouldAdd = true;
             }
             else if ( isActive( profile, profileActivationContext ) )
-            {System.out.println("BBB: " + profileId);
+            {
                 shouldAdd = true;
             }
 
             if ( !profileActivationContext.isExplicitlyInactive( profileId ) 
&& shouldAdd )
             {
                 if ( "pom".equals( profile.getSource() ) )
-                {System.out.println("CCCC: " + profileId);
+                {
                     activeFromPom.add( profile );
                 }
                 else
-                {System.out.println("DDDDD: " + profileId);
+                {
                     activeExternal.add( profile );
                 }
             }
@@ -159,7 +158,6 @@
 
         if ( activeFromPom.isEmpty() )
         {
-            System.out.println("activeFromPom.isEmpty()");
             List<String> defaultIds = 
profileActivationContext.getActiveByDefaultProfileIds();
 
             List<String> deactivatedIds = 
profileActivationContext.getExplicitlyInactiveProfileIds();
@@ -182,15 +180,13 @@
         }
 
         List<Profile> allActive = new ArrayList<Profile>( activeFromPom.size() 
+ activeExternal.size() );
-        System.out.println("Active From POM: " + activeFromPom.size() + ": 
EXTERNAL:" + activeExternal.size());
+       // System.out.println("Active From POM: " + activeFromPom.size() + ": 
EXTERNAL:" + activeExternal.size());
         allActive.addAll( activeExternal );
         allActive.addAll( activeFromPom );
-        System.out.println("All active size: " + allActive.size());
-        
+     
         List<Profile> defaults = getDefaultProfiles(allActive);
         if(defaults.size() < allActive.size())
         {
-            System.out.println("Removing: " + defaults.size());
             allActive.removeAll( defaults );
         }
         return allActive;

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=759192&r1=759191&r2=759192&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
 Fri Mar 27 16:15:25 2009
@@ -907,7 +907,14 @@
     {
         PomTestWrapper pom = this.buildPom( "profile-module-inheritance/sub", 
"dist" );
         assertEquals(0, ( (List<?>) pom.getValue( "modules" ) ).size());
-
+    }
+    
+    /** MNG-3621 */
+    public void testUncPath()
+        throws Exception
+    {
+        PomTestWrapper pom = this.buildPom( "unc-path/sub" );
+        assertEquals("file:////host/site/test-child", pom.getValue( 
"distributionManagement/site/url" ));
     }
 
     public void testPluginConfigurationUsingAttributesWithoutPluginManagement()

Added: 
maven/components/trunk/maven-project/src/test/resources-project-builder/unc-path/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/test/resources-project-builder/unc-path/pom.xml?rev=759192&view=auto
==============================================================================
--- 
maven/components/trunk/maven-project/src/test/resources-project-builder/unc-path/pom.xml
 (added)
+++ 
maven/components/trunk/maven-project/src/test/resources-project-builder/unc-path/pom.xml
 Fri Mar 27 16:15:25 2009
@@ -0,0 +1,41 @@
+<?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 xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.mng3621</groupId>
+  <artifactId>test-parent</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <name>MNG-3621 :: Parent</name>
+  <description>Test inheritance of UNC paths</description>
+
+  <modules>
+    <module>child</module>
+  </modules>
+
+  <distributionManagement>
+    <site>
+      <id>site</id>
+      <url>file:////host/site/</url>
+    </site>
+  </distributionManagement>
+</project>

Added: 
maven/components/trunk/maven-project/src/test/resources-project-builder/unc-path/sub/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/test/resources-project-builder/unc-path/sub/pom.xml?rev=759192&view=auto
==============================================================================
--- 
maven/components/trunk/maven-project/src/test/resources-project-builder/unc-path/sub/pom.xml
 (added)
+++ 
maven/components/trunk/maven-project/src/test/resources-project-builder/unc-path/sub/pom.xml
 Fri Mar 27 16:15:25 2009
@@ -0,0 +1,57 @@
+<?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 xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+<parent>
+  <groupId>org.apache.maven.its.mng3621</groupId>
+  <artifactId>test-parent</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  </parent>
+  <artifactId>test-child</artifactId>
+
+  <name>MNG-3621 :: Child</name>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.its.plugins</groupId>
+        <artifactId>maven-it-plugin-expression</artifactId>
+        <version>2.1-SNAPSHOT</version>
+        <configuration>
+          <outputFile>target/pom.properties</outputFile>
+          <expressions>
+            <expression>project/distributionManagement/site/url</expression>
+          </expressions>
+        </configuration>
+        <executions>
+          <execution>
+            <id>test</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>eval</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
+


Reply via email to