You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mt...@apache.org on 2022/04/27 18:55:12 UTC

[maven-integration-testing] branch master updated: [MNG-7404] Drop support for prefixless expressions

This is an automated email from the ASF dual-hosted git repository.

mthmulders pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-integration-testing.git


The following commit(s) were added to refs/heads/master by this push:
     new 30b13db32 [MNG-7404] Drop support for prefixless expressions
30b13db32 is described below

commit 30b13db3210a0934480e265ff73b471c391343da
Author: Maarten Mulders <mt...@apache.org>
AuthorDate: Tue Mar 15 12:10:27 2022 +0100

    [MNG-7404] Drop support for prefixless expressions
    
    Most IT's that used e.g. ${version} are now
    disabled from Maven 4.0.0-alpha-1 onward.
    The others have been updated not to use
    'prefixless' expressions anymore.
    
    Closes #141.
---
 .../org/apache/maven/it/IntegrationTestSuite.java  |  1 +
 ...ng2124PomInterpolationWithParentValuesTest.java |  2 +-
 .../MavenITmng2339BadProjectInterpolationTest.java |  3 +-
 .../it/MavenITmng3831PomInterpolationTest.java     |  2 +-
 ...enITmng7404IgnorePrefixlessExpressionsTest.java | 57 ++++++++++++++++++++++
 .../test/resources/mng-2124/parent/child/pom.xml   |  2 +-
 .../mng-7404-ignore-prefixless-expressions/pom.xml | 12 +++++
 7 files changed, 74 insertions(+), 5 deletions(-)

diff --git a/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java b/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
index 9d04ad440..48b58dec6 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
+++ b/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( MavenITmng7404IgnorePrefixlessExpressionsTest.class );
         suite.addTestSuite( MavenITmng5222MojoDeprecatedTest.class );
         suite.addTestSuite( MavenITmng7390SelectModuleOutsideCwdTest.class );
         suite.addTestSuite( MavenITmng7244IgnorePomPrefixInExpressions.class );
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2124PomInterpolationWithParentValuesTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2124PomInterpolationWithParentValuesTest.java
index c2c9c495e..d6429f940 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2124PomInterpolationWithParentValuesTest.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2124PomInterpolationWithParentValuesTest.java
@@ -54,7 +54,7 @@ public class MavenITmng2124PomInterpolationWithParentValuesTest
         verifier.resetStreams();
 
         Properties props = verifier.loadProperties( "target/parent.properties" );
-        assertEquals( "parent, child, parent, child", props.getProperty( "project.description" ) );
+        assertEquals( "parent, child", props.getProperty( "project.description" ) );
     }
 
 }
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2339BadProjectInterpolationTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2339BadProjectInterpolationTest.java
index 09a76e90d..3bc33bbcf 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2339BadProjectInterpolationTest.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2339BadProjectInterpolationTest.java
@@ -25,8 +25,6 @@ import java.io.File;
 
 /**
  * This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-2339">MNG-2339</a>.
- *
- *
  */
 public class MavenITmng2339BadProjectInterpolationTest
     extends AbstractMavenIntegrationTestCase
@@ -57,6 +55,7 @@ public class MavenITmng2339BadProjectInterpolationTest
     public void testitMNG2339b()
         throws Exception
     {
+        requiresMavenVersion( "(2.0.8,4.0.0-alpha-1)" );
         File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2339/b" );
 
         Verifier verifier;
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3831PomInterpolationTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3831PomInterpolationTest.java
index 7528f59c6..082d7112a 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3831PomInterpolationTest.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3831PomInterpolationTest.java
@@ -36,7 +36,7 @@ public class MavenITmng3831PomInterpolationTest
 
     public MavenITmng3831PomInterpolationTest()
     {
-        super( "(,2.0.2),(2.0.2,)" );
+        super( "(,2.0.2),(2.0.2,4.0.0-alpha-1)" );
     }
 
     /**
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7404IgnorePrefixlessExpressionsTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7404IgnorePrefixlessExpressionsTest.java
new file mode 100644
index 000000000..d9f3e49f0
--- /dev/null
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7404IgnorePrefixlessExpressionsTest.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 MavenITmng7404IgnorePrefixlessExpressionsTest extends AbstractMavenIntegrationTestCase
+{
+    private static final String PROJECT_PATH = "/mng-7404-ignore-prefixless-expressions";
+
+    public MavenITmng7404IgnorePrefixlessExpressionsTest()
+    {
+        super( "[4.0.0-alpha-1,)" );
+    }
+
+    public void testIgnorePrefixlessExpressions() 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<String> loadedLines = verifier.loadLines( "log.txt", "UTF-8" );
+        for ( String line : loadedLines )
+        {
+            if ( line.startsWith( "[WARNING]" ) && line.contains( "The expression ${version} is deprecated." ) )
+            {
+                fail( "Log contained unexpected deprecation warning" );
+            }
+        }
+    }
+}
diff --git a/core-it-suite/src/test/resources/mng-2124/parent/child/pom.xml b/core-it-suite/src/test/resources/mng-2124/parent/child/pom.xml
index 96f51b649..7632168f2 100644
--- a/core-it-suite/src/test/resources/mng-2124/parent/child/pom.xml
+++ b/core-it-suite/src/test/resources/mng-2124/parent/child/pom.xml
@@ -32,7 +32,7 @@ under the License.
   <packaging>pom</packaging>
 
   <name>child</name>
-  <description>${project.parent.artifactId}, ${project.artifactId}, ${parent.artifactId}, ${project.artifactId}</description>
+  <description>${project.parent.artifactId}, ${project.artifactId}</description>
 
   <build>
     <plugins>
diff --git a/core-it-suite/src/test/resources/mng-7404-ignore-prefixless-expressions/pom.xml b/core-it-suite/src/test/resources/mng-7404-ignore-prefixless-expressions/pom.xml
new file mode 100644
index 000000000..7906779c1
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-7404-ignore-prefixless-expressions/pom.xml
@@ -0,0 +1,12 @@
+<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/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>org.apache.maven.its.mng7404</groupId>
+    <artifactId>prefixless-placeholders-should-be-ignored</artifactId>
+    <version>1.0</version>
+
+    <properties>
+        <projectVersion>${version}</projectVersion>
+    </properties>
+
+</project>