mirror of https://github.com/apache/maven.git
[MNG-3877] Reporting output directory not basedir aligned when queried from MavenProject
o Added IT git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@721671 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0c3b2e5215
commit
d9f1ef0b6d
|
@ -88,6 +88,7 @@ public class IntegrationTestSuite
|
||||||
// suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class );
|
// suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class );
|
||||||
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
|
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
|
||||||
|
|
||||||
|
suite.addTestSuite( MavenITmng3877BasedirAlignedModelTest.class );
|
||||||
suite.addTestSuite( MavenITmng3866PluginConfigInheritanceTest.class );
|
suite.addTestSuite( MavenITmng3866PluginConfigInheritanceTest.class );
|
||||||
suite.addTestSuite( MavenITmng3864PerExecPluginConfigTest.class );
|
suite.addTestSuite( MavenITmng3864PerExecPluginConfigTest.class );
|
||||||
suite.addTestSuite( MavenITmng3863AutoPluginGroupIdTest.class );
|
suite.addTestSuite( MavenITmng3863AutoPluginGroupIdTest.class );
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class MavenITmng3475BaseAlignedDirTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify that project directories are basedir aligned when inspected by plugins.
|
* Verify that project directories are basedir aligned when queried by plugin parameter expressions.
|
||||||
*/
|
*/
|
||||||
public void testitMNG3475()
|
public void testitMNG3475()
|
||||||
throws Exception
|
throws Exception
|
||||||
|
@ -56,46 +56,33 @@ public class MavenITmng3475BaseAlignedDirTest
|
||||||
verifier.verifyErrorFreeLog();
|
verifier.verifyErrorFreeLog();
|
||||||
verifier.resetStreams();
|
verifier.resetStreams();
|
||||||
|
|
||||||
/*
|
|
||||||
* NOTE: The script source directory is deliberately excluded from the checks due to MNG-3741.
|
|
||||||
*/
|
|
||||||
|
|
||||||
Properties configProps = verifier.loadProperties( "target/config.properties" );
|
Properties configProps = verifier.loadProperties( "target/config.properties" );
|
||||||
Properties modelProps = verifier.loadProperties( "target/model.properties" );
|
|
||||||
|
|
||||||
assertPathEquals( testDir, "target", configProps.getProperty( "mapParam.buildDirectory" ) );
|
assertPathEquals( testDir, "target", configProps.getProperty( "mapParam.buildDirectory" ) );
|
||||||
assertPathEquals( testDir, "target", modelProps.getProperty( "project.build.directory" ) );
|
|
||||||
|
|
||||||
assertPathEquals( testDir, "target/classes", configProps.getProperty( "mapParam.buildOutputDirectory" ) );
|
assertPathEquals( testDir, "target/classes", configProps.getProperty( "mapParam.buildOutputDirectory" ) );
|
||||||
assertPathEquals( testDir, "target/classes", modelProps.getProperty( "project.build.outputDirectory" ) );
|
|
||||||
|
|
||||||
assertPathEquals( testDir, "target/test-classes", configProps.getProperty( "mapParam.buildTestOutputDirectory" ) );
|
assertPathEquals( testDir, "target/test-classes", configProps.getProperty( "mapParam.buildTestOutputDirectory" ) );
|
||||||
assertPathEquals( testDir, "target/test-classes", modelProps.getProperty( "project.build.testOutputDirectory" ) );
|
|
||||||
|
|
||||||
assertPathEquals( testDir, "src/main/java", configProps.getProperty( "mapParam.buildSourceDirectory" ) );
|
assertPathEquals( testDir, "src/main/java", configProps.getProperty( "mapParam.buildSourceDirectory" ) );
|
||||||
assertPathEquals( testDir, "src/main/java", modelProps.getProperty( "project.build.sourceDirectory" ) );
|
|
||||||
|
|
||||||
assertPathEquals( testDir, "src/test/java", configProps.getProperty( "mapParam.buildTestSourceDirectory" ) );
|
assertPathEquals( testDir, "src/test/java", configProps.getProperty( "mapParam.buildTestSourceDirectory" ) );
|
||||||
assertPathEquals( testDir, "src/test/java", modelProps.getProperty( "project.build.testSourceDirectory" ) );
|
|
||||||
|
|
||||||
if ( matchesVersionRange( "[2.1.0-M1,)" ) )
|
if ( matchesVersionRange( "[2.1.0-M1,)" ) )
|
||||||
{
|
{
|
||||||
assertPathEquals( testDir, "target/site", configProps.getProperty( "mapParam.reportingOutputDirectory" ) );
|
assertPathEquals( testDir, "target/site", configProps.getProperty( "mapParam.reportingOutputDirectory" ) );
|
||||||
assertPathEquals( testDir, "target/site", modelProps.getProperty( "project.reporting.outputDirectory" ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assertPathEquals( testDir, "src/main/resources", modelProps.getProperty( "project.build.resources.0.directory" ) );
|
/*
|
||||||
|
* NOTE: The script source directory is deliberately excluded from the checks due to MNG-3741.
|
||||||
assertPathEquals( testDir, "src/test/resources", modelProps.getProperty( "project.build.testResources.0.directory" ) );
|
*/
|
||||||
|
|
||||||
assertPathEquals( testDir, "src/main/filters/it.properties", modelProps.getProperty( "project.build.filters.0" ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertPathEquals( File basedir, String subdir, String path )
|
private void assertPathEquals( File basedir, String expected, String actual )
|
||||||
{
|
{
|
||||||
File actual = new File( path );
|
File actualFile = new File( actual );
|
||||||
assertTrue( "path not absolute: " + actual, actual.isAbsolute() );
|
assertTrue( "path not absolute: " + actualFile, actualFile.isAbsolute() );
|
||||||
assertEquals( new File( basedir, subdir ), actual );
|
assertEquals( new File( basedir, expected ), actualFile );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,95 @@
|
||||||
|
package org.apache.maven.it;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.it.Verifier;
|
||||||
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-3877">MNG-3877</a>.
|
||||||
|
*
|
||||||
|
* @author Benjamin Bentmann
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class MavenITmng3877BasedirAlignedModelTest
|
||||||
|
extends AbstractMavenIntegrationTestCase
|
||||||
|
{
|
||||||
|
|
||||||
|
public MavenITmng3877BasedirAlignedModelTest()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify that project directories are basedir aligned when inspected by plugins via the MavenProject instance.
|
||||||
|
*/
|
||||||
|
public void testitMNG3877()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3877" );
|
||||||
|
|
||||||
|
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
|
||||||
|
verifier.setAutoclean( false );
|
||||||
|
verifier.deleteDirectory( "target" );
|
||||||
|
verifier.executeGoal( "validate" );
|
||||||
|
verifier.verifyErrorFreeLog();
|
||||||
|
verifier.resetStreams();
|
||||||
|
|
||||||
|
Properties modelProps = verifier.loadProperties( "target/model.properties" );
|
||||||
|
|
||||||
|
assertPathEquals( testDir, "target", modelProps.getProperty( "project.build.directory" ) );
|
||||||
|
|
||||||
|
assertPathEquals( testDir, "target/classes", modelProps.getProperty( "project.build.outputDirectory" ) );
|
||||||
|
|
||||||
|
assertPathEquals( testDir, "target/test-classes", modelProps.getProperty( "project.build.testOutputDirectory" ) );
|
||||||
|
|
||||||
|
assertPathEquals( testDir, "src/main/java", modelProps.getProperty( "project.build.sourceDirectory" ) );
|
||||||
|
assertPathEquals( testDir, "src/main/java", modelProps.getProperty( "project.compileSourceRoots.0" ) );
|
||||||
|
|
||||||
|
assertPathEquals( testDir, "src/test/java", modelProps.getProperty( "project.build.testSourceDirectory" ) );
|
||||||
|
assertPathEquals( testDir, "src/test/java", modelProps.getProperty( "project.testCompileSourceRoots.0" ) );
|
||||||
|
|
||||||
|
assertPathEquals( testDir, "src/main/resources", modelProps.getProperty( "project.build.resources.0.directory" ) );
|
||||||
|
|
||||||
|
assertPathEquals( testDir, "src/test/resources", modelProps.getProperty( "project.build.testResources.0.directory" ) );
|
||||||
|
|
||||||
|
assertPathEquals( testDir, "src/main/filters/it.properties", modelProps.getProperty( "project.build.filters.0" ) );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NOTE: The script source directory is deliberately excluded from the checks due to MNG-3741.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// FIXME: MNG-3877
|
||||||
|
if ( matchesVersionRange( "(4,)" ) )
|
||||||
|
{
|
||||||
|
assertPathEquals( testDir, "target/site", modelProps.getProperty( "project.reporting.outputDirectory" ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assertPathEquals( File basedir, String expected, String actual )
|
||||||
|
{
|
||||||
|
File actualFile = new File( actual );
|
||||||
|
assertTrue( "path not absolute: " + actualFile, actualFile.isAbsolute() );
|
||||||
|
assertEquals( new File( basedir, expected ), actualFile );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -29,16 +29,23 @@ under the License.
|
||||||
|
|
||||||
<name>Maven Integration Test :: MNG-3475</name>
|
<name>Maven Integration Test :: MNG-3475</name>
|
||||||
<description>
|
<description>
|
||||||
Verify that project directories are basedir aligned when inspected by plugins.
|
Verify that project directories are basedir aligned when queried by plugin parameter expressions.
|
||||||
</description>
|
</description>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<filters>
|
<!--
|
||||||
<filter>src/main/filters/it.properties</filter>
|
NOTE: Deliberately re-specify default paths to decouple from super POM and interpolation. Proper handling of
|
||||||
</filters>
|
*relative* paths is the whole point of this test.
|
||||||
|
-->
|
||||||
|
<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>
|
||||||
|
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<!-- This checks the project directories retrieved via plugin configuration -->
|
|
||||||
<groupId>org.apache.maven.its.plugins</groupId>
|
<groupId>org.apache.maven.its.plugins</groupId>
|
||||||
<artifactId>maven-it-plugin-configuration</artifactId>
|
<artifactId>maven-it-plugin-configuration</artifactId>
|
||||||
<version>2.1-SNAPSHOT</version>
|
<version>2.1-SNAPSHOT</version>
|
||||||
|
@ -64,36 +71,14 @@ under the License.
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<!-- This checks the project directories as retrieved via pure MavenProjet API -->
|
|
||||||
<groupId>org.apache.maven.its.plugins</groupId>
|
|
||||||
<artifactId>maven-it-plugin-expression</artifactId>
|
|
||||||
<version>2.1-SNAPSHOT</version>
|
|
||||||
<configuration>
|
|
||||||
<outputFile>target/model.properties</outputFile>
|
|
||||||
<expressions>
|
|
||||||
<expression>project/build/directory</expression>
|
|
||||||
<expression>project/build/outputDirectory</expression>
|
|
||||||
<expression>project/build/testOutputDirectory</expression>
|
|
||||||
<expression>project/build/sourceDirectory</expression>
|
|
||||||
<expression>project/build/testSourceDirectory</expression>
|
|
||||||
<expression>project/build/scriptSourceDirectory</expression>
|
|
||||||
<expression>project/build/resources/0/directory</expression>
|
|
||||||
<expression>project/build/testResources/0/directory</expression>
|
|
||||||
<expression>project/build/filters/0</expression>
|
|
||||||
<expression>project/reporting/outputDirectory</expression>
|
|
||||||
</expressions>
|
|
||||||
</configuration>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>effective-model</id>
|
|
||||||
<phase>validate</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>eval</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
<reporting>
|
||||||
|
<!--
|
||||||
|
NOTE: Deliberately re-specify default paths to decouple from super POM and interpolation. Proper handling of
|
||||||
|
*relative* paths is the whole point of this test.
|
||||||
|
-->
|
||||||
|
<outputDirectory>target/site</outputDirectory>
|
||||||
|
</reporting>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -0,0 +1,103 @@
|
||||||
|
<?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.mng3877</groupId>
|
||||||
|
<artifactId>mng3877</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
<name>Maven Integration Test :: MNG-3877</name>
|
||||||
|
<description>
|
||||||
|
Verify that project directories are basedir aligned when inspected by plugins.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<!--
|
||||||
|
NOTE: Deliberately re-specify default paths to decouple from super POM and interpolation. Proper handling of
|
||||||
|
*relative* paths is the whole point of this test.
|
||||||
|
-->
|
||||||
|
<sourceDirectory>src/main/java</sourceDirectory>
|
||||||
|
<testSourceDirectory>src/test/java</testSourceDirectory>
|
||||||
|
<scriptSourceDirectory>src/main/scripts</scriptSourceDirectory>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<testResources>
|
||||||
|
<testResource>
|
||||||
|
<directory>src/test/resources</directory>
|
||||||
|
</testResource>
|
||||||
|
</testResources>
|
||||||
|
<directory>target</directory>
|
||||||
|
<outputDirectory>target/classes</outputDirectory>
|
||||||
|
<testOutputDirectory>target/test-classes</testOutputDirectory>
|
||||||
|
<filters>
|
||||||
|
<filter>src/main/filters/it.properties</filter>
|
||||||
|
</filters>
|
||||||
|
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.its.plugins</groupId>
|
||||||
|
<artifactId>maven-it-plugin-expression</artifactId>
|
||||||
|
<version>2.1-SNAPSHOT</version>
|
||||||
|
<configuration>
|
||||||
|
<outputFile>target/model.properties</outputFile>
|
||||||
|
<expressions>
|
||||||
|
<expression>project/build/directory</expression>
|
||||||
|
<expression>project/build/outputDirectory</expression>
|
||||||
|
<expression>project/build/testOutputDirectory</expression>
|
||||||
|
<expression>project/build/sourceDirectory</expression>
|
||||||
|
<expression>project/build/testSourceDirectory</expression>
|
||||||
|
<expression>project/build/scriptSourceDirectory</expression>
|
||||||
|
<expression>project/build/resources/0/directory</expression>
|
||||||
|
<expression>project/build/testResources/0/directory</expression>
|
||||||
|
<expression>project/build/filters/0</expression>
|
||||||
|
<expression>project/reporting/outputDirectory</expression>
|
||||||
|
<expression>project/compileSourceRoots</expression>
|
||||||
|
<expression>project/testCompileSourceRoots</expression>
|
||||||
|
<expression>project/scriptSourceRoots</expression>
|
||||||
|
</expressions>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>effective-model</id>
|
||||||
|
<phase>validate</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>eval</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<reporting>
|
||||||
|
<!--
|
||||||
|
NOTE: Deliberately re-specify default paths to decouple from super POM and interpolation. Proper handling of
|
||||||
|
*relative* paths is the whole point of this test.
|
||||||
|
-->
|
||||||
|
<outputDirectory>target/site</outputDirectory>
|
||||||
|
</reporting>
|
||||||
|
</project>
|
Loading…
Reference in New Issue