[MNG-3621] -site url inheritance broken for UNC paths

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@759192 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Britton Isbell 2009-03-27 16:15:25 +00:00
parent 5d0b74b0a4
commit 60c1b6f7b6
5 changed files with 114 additions and 13 deletions

View File

@ -152,12 +152,12 @@ public class DistributionManagementProcessor
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 );
}
}

View File

@ -132,26 +132,25 @@ public class DefaultProfileManager
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 @@ public class DefaultProfileManager
if ( activeFromPom.isEmpty() )
{
System.out.println("activeFromPom.isEmpty()");
List<String> defaultIds = profileActivationContext.getActiveByDefaultProfileIds();
List<String> deactivatedIds = profileActivationContext.getExplicitlyInactiveProfileIds();
@ -182,15 +180,13 @@ public class DefaultProfileManager
}
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;

View File

@ -907,7 +907,14 @@ public class PomConstructionTest
{
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()

View File

@ -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>

View File

@ -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>