[MNG-3760] Support property ${baseurl} to get RFC-compliant URL of project base directory

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@755710 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-03-18 19:29:18 +00:00
parent f694325b14
commit 09c1130eca
3 changed files with 53 additions and 1 deletions

View File

@ -305,6 +305,12 @@ public class ProcessorContext
PomInterpolatorTag.PROJECT_PROPERTIES.name() ) );
standardInterpolatorProperties.add( new InterpolatorProperty( "${pom.basedir}", basedir,
PomInterpolatorTag.PROJECT_PROPERTIES.name() ) );
String baseuri = dm.getProjectDirectory().toURI().toString();
standardInterpolatorProperties.add( new InterpolatorProperty( "${project.baseUri}", baseuri,
PomInterpolatorTag.PROJECT_PROPERTIES.name() ) );
standardInterpolatorProperties.add( new InterpolatorProperty( "${pom.baseUri}", baseuri,
PomInterpolatorTag.PROJECT_PROPERTIES.name() ) );
}
for ( ModelProperty mp : modelProperties )

View File

@ -677,7 +677,7 @@ public class PomConstructionTest
new File( pom.getValue( "properties/siteOut" ).toString() ) );
}
/* FIXME: cf. MNG-3944*/
/* MNG-3944*/
public void testInterpolationOfBasedirInPomWithUnusualName()
throws Exception
{
@ -951,6 +951,14 @@ public class PomConstructionTest
assertEquals( "org.apache.maven.its.mng4070", pom.getValue( "groupId" ) );
}
/* MNG-3760*/
public void testInterpolationOfBaseUrl()
throws Exception
{
PomTestWrapper pom = buildPom( "baseurl-interpolation/pom.xml" );
assertEquals( pom.getBasedir().toURI().toString(), pom.getValue( "properties/prop1" ).toString() );
}
private void assertPathWithNormalizedFileSeparators( Object value )
{

View File

@ -0,0 +1,38 @@
<?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.mng3760</groupId>
<artifactId>test1</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Maven Integration Test :: MNG-3760</name>
<description>
Test interpolation of ${project.baseUri}
</description>
<properties>
<!-- this is where we collect all the interpolated values for the POM dump -->
<prop1>${project.baseUri}</prop1>
</properties>
</project>