From 0776e8efa83a169f1d683590614b3a9d4f6b430f Mon Sep 17 00:00:00 2001 From: Giovanni van der Schelde Date: Tue, 1 Feb 2022 15:02:17 +0100 Subject: [PATCH] [MNG-7244] Remove deprecated WARNING for usage of pom.X placeholders This closes #139 --- .../apache/maven/it/IntegrationTestSuite.java | 1 + ...nIT0140InterpolationWithPomPrefixTest.java | 6 +- ...ecatedPomInterpolationExpressionsTest.java | 6 +- ...ITmng7244IgnorePomPrefixInExpressions.java | 57 +++++++++++++++++++ .../src/test/resources/it0012/pom.xml | 5 +- .../resources/mng-2124/parent/child/pom.xml | 2 +- .../resources/mng-3396/dependencies/b/pom.xml | 2 +- .../resources/mng-3396/plugin/plugin/pom.xml | 4 +- .../resources/mng-3396/pluginuser/pom.xml | 2 +- .../src/test/resources/mng-3671/pom.xml | 2 +- .../apache/maven/its/mng4403/b/0.1/b-0.1.pom | 3 +- .../maven/its/mng4403/b/0.1/b-0.1.pom.md5 | 2 +- .../maven/its/mng4403/b/0.1/b-0.1.pom.sha1 | 2 +- .../pom.xml | 12 ++++ 14 files changed, 89 insertions(+), 17 deletions(-) create mode 100644 its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7244IgnorePomPrefixInExpressions.java create mode 100644 its/core-it-suite/src/test/resources/mng-7244-ignore-pom-prefix-in-expressions/pom.xml diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java b/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java index 92e471e34d..2c3e7448a3 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java @@ -106,6 +106,7 @@ public class IntegrationTestSuite // Tests that don't run stable and need to be fixed // ------------------------------------------------------------------------------------------------------------- // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137 + suite.addTestSuite( MavenITmng7244IgnorePomPrefixInExpressions.class ); suite.addTestSuite( MavenITmng7349RelocationWarningTest.class ); suite.addTestSuite( MavenITmng6326CoreExtensionsNotFoundTest.class ); suite.addTestSuite( MavenITmng5561PluginRelocationLosesConfigurationTest.class ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0140InterpolationWithPomPrefixTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0140InterpolationWithPomPrefixTest.java index d0134e76cb..1e03241f26 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0140InterpolationWithPomPrefixTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0140InterpolationWithPomPrefixTest.java @@ -25,16 +25,18 @@ import java.io.File; import java.util.Properties; /** + * MNG-7244 removes the deprecation of + * pom.X. + * See {@link MavenITmng7244IgnorePomPrefixInExpressions}. * * @author Benjamin Bentmann - * */ public class MavenIT0140InterpolationWithPomPrefixTest extends AbstractMavenIntegrationTestCase { public MavenIT0140InterpolationWithPomPrefixTest() { - super( ALL_MAVEN_VERSIONS ); + super( "[2.0,4.0.0-alpha-1)" ); } /** diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4421DeprecatedPomInterpolationExpressionsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4421DeprecatedPomInterpolationExpressionsTest.java index 394a9782cb..ad01376c71 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4421DeprecatedPomInterpolationExpressionsTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4421DeprecatedPomInterpolationExpressionsTest.java @@ -28,6 +28,10 @@ import java.util.Properties; /** * This is a test set for MNG-4421. * + * But MNG-7244 removes the deprecation of + * pom.X. + * See {@link MavenITmng7244IgnorePomPrefixInExpressions}. + * * @author Benjamin Bentmann */ public class MavenITmng4421DeprecatedPomInterpolationExpressionsTest @@ -36,7 +40,7 @@ public class MavenITmng4421DeprecatedPomInterpolationExpressionsTest public MavenITmng4421DeprecatedPomInterpolationExpressionsTest() { - super( "[3.0-alpha-3,)" ); + super( "[3.0-alpha-3,4.0.0-alpha-1)" ); } /** diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7244IgnorePomPrefixInExpressions.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7244IgnorePomPrefixInExpressions.java new file mode 100644 index 0000000000..a523eb47b0 --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7244IgnorePomPrefixInExpressions.java @@ -0,0 +1,57 @@ +/* + * 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.it; + +import org.apache.maven.it.util.ResourceExtractor; + +import java.io.File; +import java.io.IOException; +import java.util.List; + +public class MavenITmng7244IgnorePomPrefixInExpressions extends AbstractMavenIntegrationTestCase +{ + private static final String PROJECT_PATH = "/mng-7244-ignore-pom-prefix-in-expressions"; + + public MavenITmng7244IgnorePomPrefixInExpressions() + { + super( "[4.0.0-alpha-1,)" ); + } + + public void testIgnorePomPrefixInExpressions() throws IOException, VerificationException + { + final File projectDir = ResourceExtractor.simpleExtractResources( getClass(), PROJECT_PATH ); + final Verifier verifier = newVerifier( projectDir.getAbsolutePath() ); + + verifier.executeGoal( "validate" ); + + verifyLogDoesNotContainUnexpectedWarning( verifier ); + } + + private void verifyLogDoesNotContainUnexpectedWarning( Verifier verifier ) throws IOException + { + List loadedLines = verifier.loadLines( "log.txt", "UTF-8" ); + for ( String line : loadedLines ) + { + if ( line.startsWith( "[WARNING]" ) && line.contains( "The expression ${pom.version} is deprecated." ) ) + { + fail( "Log contained unexpected deprecation warning" ); + } + } + } +} diff --git a/its/core-it-suite/src/test/resources/it0012/pom.xml b/its/core-it-suite/src/test/resources/it0012/pom.xml index f03cba0ea1..05531f90db 100644 --- a/its/core-it-suite/src/test/resources/it0012/pom.xml +++ b/its/core-it-suite/src/test/resources/it0012/pom.xml @@ -32,19 +32,16 @@ under the License. -POM content (available with 3 prefixes): +POM content (available with 2 prefixes): project.version: ${project.version} - pom.version: ${pom.version} version: ${version} basedir (available with 2 prefixes): basedir: ${basedir} project.basedir: ${project.basedir} - pom.basedir: ${pom.basedir} baseUri (available with 2 prefixes): project.baseUri: ${project.baseUri} - pom.baseUri: ${pom.baseUri} build.timestamp (only if build start time defined): build.timestamp: ${build.timestamp} diff --git a/its/core-it-suite/src/test/resources/mng-2124/parent/child/pom.xml b/its/core-it-suite/src/test/resources/mng-2124/parent/child/pom.xml index b54b8e76b4..96f51b6494 100644 --- a/its/core-it-suite/src/test/resources/mng-2124/parent/child/pom.xml +++ b/its/core-it-suite/src/test/resources/mng-2124/parent/child/pom.xml @@ -32,7 +32,7 @@ under the License. pom child - ${pom.parent.artifactId}, ${pom.artifactId}, ${parent.artifactId}, ${pom.artifactId} + ${project.parent.artifactId}, ${project.artifactId}, ${parent.artifactId}, ${project.artifactId} diff --git a/its/core-it-suite/src/test/resources/mng-3396/dependencies/b/pom.xml b/its/core-it-suite/src/test/resources/mng-3396/dependencies/b/pom.xml index 132a95cc9c..7c9b73632e 100644 --- a/its/core-it-suite/src/test/resources/mng-3396/dependencies/b/pom.xml +++ b/its/core-it-suite/src/test/resources/mng-3396/dependencies/b/pom.xml @@ -12,7 +12,7 @@ 1.0 - ${pom.groupId} + ${project.groupId} A [1.0,2.0) diff --git a/its/core-it-suite/src/test/resources/mng-3396/plugin/plugin/pom.xml b/its/core-it-suite/src/test/resources/mng-3396/plugin/plugin/pom.xml index 12cccf0a81..cde4ac1e77 100644 --- a/its/core-it-suite/src/test/resources/mng-3396/plugin/plugin/pom.xml +++ b/its/core-it-suite/src/test/resources/mng-3396/plugin/plugin/pom.xml @@ -19,7 +19,7 @@ 2.0.4 - ${pom.groupId} + ${project.groupId} B 1.0 @@ -27,7 +27,7 @@ - ${pom.groupId} + ${project.groupId} A 3.0 diff --git a/its/core-it-suite/src/test/resources/mng-3396/pluginuser/pom.xml b/its/core-it-suite/src/test/resources/mng-3396/pluginuser/pom.xml index 87cc38bbcc..ed7f3b59b6 100644 --- a/its/core-it-suite/src/test/resources/mng-3396/pluginuser/pom.xml +++ b/its/core-it-suite/src/test/resources/mng-3396/pluginuser/pom.xml @@ -10,7 +10,7 @@ - ${pom.groupId} + ${project.groupId} plugin 1.0 diff --git a/its/core-it-suite/src/test/resources/mng-3671/pom.xml b/its/core-it-suite/src/test/resources/mng-3671/pom.xml index b9dafc4496..cc7a6be469 100644 --- a/its/core-it-suite/src/test/resources/mng-3671/pom.xml +++ b/its/core-it-suite/src/test/resources/mng-3671/pom.xml @@ -24,7 +24,7 @@ junit junit - ${pom.version} + ${project.version} diff --git a/its/core-it-suite/src/test/resources/mng-4403/repo/org/apache/maven/its/mng4403/b/0.1/b-0.1.pom b/its/core-it-suite/src/test/resources/mng-4403/repo/org/apache/maven/its/mng4403/b/0.1/b-0.1.pom index 28ed21f156..477a089e6d 100644 --- a/its/core-it-suite/src/test/resources/mng-4403/repo/org/apache/maven/its/mng4403/b/0.1/b-0.1.pom +++ b/its/core-it-suite/src/test/resources/mng-4403/repo/org/apache/maven/its/mng4403/b/0.1/b-0.1.pom @@ -80,8 +80,7 @@ under the License. org.apache.maven.its.mng4403 a - - ${pom.version} + ${project.version} diff --git a/its/core-it-suite/src/test/resources/mng-4403/repo/org/apache/maven/its/mng4403/b/0.1/b-0.1.pom.md5 b/its/core-it-suite/src/test/resources/mng-4403/repo/org/apache/maven/its/mng4403/b/0.1/b-0.1.pom.md5 index 54fb184e77..ac6000c111 100644 --- a/its/core-it-suite/src/test/resources/mng-4403/repo/org/apache/maven/its/mng4403/b/0.1/b-0.1.pom.md5 +++ b/its/core-it-suite/src/test/resources/mng-4403/repo/org/apache/maven/its/mng4403/b/0.1/b-0.1.pom.md5 @@ -1 +1 @@ -7715ed576590b23bd48ffe59fb765592 \ No newline at end of file +745853997ed31ec0b494faefcaa5616f \ No newline at end of file diff --git a/its/core-it-suite/src/test/resources/mng-4403/repo/org/apache/maven/its/mng4403/b/0.1/b-0.1.pom.sha1 b/its/core-it-suite/src/test/resources/mng-4403/repo/org/apache/maven/its/mng4403/b/0.1/b-0.1.pom.sha1 index c7bb4ba4d7..236af5a834 100644 --- a/its/core-it-suite/src/test/resources/mng-4403/repo/org/apache/maven/its/mng4403/b/0.1/b-0.1.pom.sha1 +++ b/its/core-it-suite/src/test/resources/mng-4403/repo/org/apache/maven/its/mng4403/b/0.1/b-0.1.pom.sha1 @@ -1 +1 @@ -e4ca48b3c2c97cbe74dc167a57338d62f13f0ce5 \ No newline at end of file +c75f5314c692293d24b5b4c1bdb78d1f4c920523 \ No newline at end of file diff --git a/its/core-it-suite/src/test/resources/mng-7244-ignore-pom-prefix-in-expressions/pom.xml b/its/core-it-suite/src/test/resources/mng-7244-ignore-pom-prefix-in-expressions/pom.xml new file mode 100644 index 0000000000..2f034e1ea1 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-7244-ignore-pom-prefix-in-expressions/pom.xml @@ -0,0 +1,12 @@ + + 4.0.0 + + org.apache.maven.its.mng7244 + deprecated-pom-placeholders-should-be-ignored + 1.0 + + + ${pom.version} + + +