o Created UT from MNG-3822

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@729511 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2008-12-26 16:56:31 +00:00
parent fd68f59250
commit 8d845eaa55
2 changed files with 80 additions and 0 deletions

View File

@ -390,6 +390,26 @@ public class PomConstructionTest
assertTrue( pom.getValue( "properties/projectSiteOut" ).toString().endsWith( "doc" ) ); assertTrue( pom.getValue( "properties/projectSiteOut" ).toString().endsWith( "doc" ) );
} }
public void testInterpolationWithBasedirAlignedDirectories()
throws Exception
{
PomTestWrapper pom = buildPom( "basedir-aligned-interpolation" );
assertEquals( new File( pom.getBasedir(), "src/main/java" ),
new File( pom.getValue( "properties/buildMainSrc" ).toString() ) );
assertEquals( new File( pom.getBasedir(), "src/test/java" ),
new File( pom.getValue( "properties/buildTestSrc" ).toString() ) );
assertEquals( new File( pom.getBasedir(), "src/main/scripts" ),
new File( pom.getValue( "properties/buildScriptSrc" ).toString() ) );
assertEquals( new File( pom.getBasedir(), "target" ),
new File( pom.getValue( "properties/buildOut" ).toString() ) );
assertEquals( new File( pom.getBasedir(), "target/classes" ),
new File( pom.getValue( "properties/buildMainOut" ).toString() ) );
assertEquals( new File( pom.getBasedir(), "target/test-classes" ),
new File( pom.getValue( "properties/buildTestOut" ).toString() ) );
assertEquals( new File( pom.getBasedir(), "target/site" ),
new File( pom.getValue( "properties/siteOut" ).toString() ) );
}
private PomArtifactResolver artifactResolver( String basedir ) private PomArtifactResolver artifactResolver( String basedir )
{ {
return new FileBasedPomArtifactResolver( new File( BASE_POM_DIR, basedir ) ); return new FileBasedPomArtifactResolver( new File( BASE_POM_DIR, basedir ) );

View File

@ -0,0 +1,60 @@
<?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.mng3822</groupId>
<artifactId>test1</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Maven Integration Test :: MNG-3822</name>
<description>
Verify that POM interpolation uses basedir-aligned build directories.
</description>
<properties>
<!-- this is where we collect all the interpolated values for the POM dump -->
<buildMainSrc>${project.build.sourceDirectory}</buildMainSrc>
<buildTestSrc>${project.build.testSourceDirectory}</buildTestSrc>
<buildScriptSrc>${project.build.scriptSourceDirectory}</buildScriptSrc>
<buildOut>${project.build.directory}</buildOut>
<buildMainOut>${project.build.outputDirectory}</buildMainOut>
<buildTestOut>${project.build.testOutputDirectory}</buildTestOut>
<siteOut>${project.reporting.outputDirectory}</siteOut>
</properties>
<build>
<!--
NOTE: Deliberately set all build directories to relative paths to ensure they really need basedir alignment.
-->
<sourceDirectory>src/main/java</sourceDirectory>
<testSourceDirectory>src/test/java</testSourceDirectory>
<scriptSourceDirectory>src/main/scripts</scriptSourceDirectory>
<directory>target</directory>
<outputDirectory>target/classes</outputDirectory>
<testOutputDirectory>target/test-classes</testOutputDirectory>
</build>
<reporting>
<outputDirectory>target/site</outputDirectory>
</reporting>
</project>