diff --git a/its/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java b/its/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java index 364a743a8a..9942f7efa9 100644 --- a/its/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java +++ b/its/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java @@ -76,6 +76,7 @@ MavenITmng3415JunkRepositoryMetadataTest MavenITmng3645POMSyntaxErrorTest */ + suite.addTestSuite( MavenITmng3747PrefixedPathExpressionTest.class ); suite.addTestSuite( MavenITmng3746POMPropertyOverrideTest.class ); suite.addTestSuite( MavenITmng3743ForkWithPluginManagementTest.class ); suite.addTestSuite( MavenITmng3740SelfReferentialReactorProjectsTest.class ); diff --git a/its/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3747PrefixedPathExpressionTest.java b/its/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3747PrefixedPathExpressionTest.java new file mode 100644 index 0000000000..90bd752800 --- /dev/null +++ b/its/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3747PrefixedPathExpressionTest.java @@ -0,0 +1,66 @@ +/* + * 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. + */ + +package org.apache.maven.integrationtests; + +import java.io.File; + +import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; +import org.apache.maven.it.Verifier; +import org.apache.maven.it.util.ResourceExtractor; + +/** + * This is a test set for MNG-3747. + * + * @todo Fill in a better description of what this test verifies! + * + * @author Brian Fox + * @author jdcasey + * + */ +public class MavenITmng3747PrefixedPathExpressionTest + extends AbstractMavenIntegrationTestCase +{ + public MavenITmng3747PrefixedPathExpressionTest() + throws InvalidVersionSpecificationException + { + super( "(2.0.8,)" ); // only test in 2.0.9+ + } + + public void testitMNG3747 () + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3747-prefixedPathExpression" ); + File pluginDir = new File( testDir, "maven-mng3747-plugin" ); + File projectDir = new File( testDir, "project" ); + + Verifier verifier; + + verifier = new Verifier( pluginDir.getAbsolutePath() ); + verifier.executeGoal( "install" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + verifier = new Verifier( projectDir.getAbsolutePath() ); + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + } +} diff --git a/its/core-integration-tests/src/test/resources/mng-3747-prefixedPathExpression/maven-mng3747-plugin/pom.xml b/its/core-integration-tests/src/test/resources/mng-3747-prefixedPathExpression/maven-mng3747-plugin/pom.xml new file mode 100644 index 0000000000..f1ffde9c5e --- /dev/null +++ b/its/core-integration-tests/src/test/resources/mng-3747-prefixedPathExpression/maven-mng3747-plugin/pom.xml @@ -0,0 +1,16 @@ + + 4.0.0 + org.apache.maven.its.mng3747 + maven-mng3747-plugin + maven-plugin + maven-mng3747-plugin Maven Mojo + 1 + http://maven.apache.org + + + org.apache.maven + maven-plugin-api + 2.0 + + + \ No newline at end of file diff --git a/its/core-integration-tests/src/test/resources/mng-3747-prefixedPathExpression/maven-mng3747-plugin/src/main/java/jar/MyMojo.java b/its/core-integration-tests/src/test/resources/mng-3747-prefixedPathExpression/maven-mng3747-plugin/src/main/java/jar/MyMojo.java new file mode 100644 index 0000000000..9e15eb4c09 --- /dev/null +++ b/its/core-integration-tests/src/test/resources/mng-3747-prefixedPathExpression/maven-mng3747-plugin/src/main/java/jar/MyMojo.java @@ -0,0 +1,56 @@ +package jar; + +/* + * Copyright 2001-2005 The Apache Software Foundation. + * + * Licensed 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 java.io.File; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; + +/** + * @goal test + */ +public class MyMojo + extends AbstractMojo +{ + /** + * Location of the file. + * @parameter default-value="${project.build.directory}" + * @readonly + */ + private File buildDirectory; + + /** + * @parameter + * @required + */ + private String config; + + public void execute() + throws MojoExecutionException + { + if ( !buildDirectory.isAbsolute() ) + { + throw new MojoExecutionException( "The expression 'project.build.directory' didn't render an absolute path when injected from a plugin parameter default value." ); + } + + if ( config.indexOf( buildDirectory.getAbsolutePath() ) < 0 ) + { + throw new MojoExecutionException( "The expression 'project.build.directory' didn't render an absolute path when used inside a plugin configuration of type String." ); + } + } +} diff --git a/its/core-integration-tests/src/test/resources/mng-3747-prefixedPathExpression/project/pom.xml b/its/core-integration-tests/src/test/resources/mng-3747-prefixedPathExpression/project/pom.xml new file mode 100644 index 0000000000..489d1aebbe --- /dev/null +++ b/its/core-integration-tests/src/test/resources/mng-3747-prefixedPathExpression/project/pom.xml @@ -0,0 +1,31 @@ + + + 4.0.0 + org.apache.maven.its.mng3747 + project + 1 + pom + + + relative + + + org.apache.maven.its.mng3747 + maven-mng3747-plugin + 1 + + + test + validate + + test + + + path is: ${project.build.directory}/somepath + + + + + + + diff --git a/its/core-integration-tests/src/test/resources/mng-3747-prefixedPathExpression/readme.txt b/its/core-integration-tests/src/test/resources/mng-3747-prefixedPathExpression/readme.txt new file mode 100644 index 0000000000..978b4748b9 --- /dev/null +++ b/its/core-integration-tests/src/test/resources/mng-3747-prefixedPathExpression/readme.txt @@ -0,0 +1 @@ +Fill this in with a description of the scenario this test attempts to check. Also include instructions for running the test manually from the command line. \ No newline at end of file