You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sj...@apache.org on 2022/04/16 08:40:20 UTC

[maven-integration-testing] 01/01: [MNG-5222] Improvement in deprecated params detection

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

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

commit 486a6d16061a90d8da4fd9bd54128522f17d0e7a
Author: Slawomir Jaranowski <s....@gmail.com>
AuthorDate: Sat Apr 16 09:37:55 2022 +0200

    [MNG-5222] Improvement in deprecated params detection
---
 .../it/MavenITmng5222MojoDeprecatedParamsTest.java | 30 +++++++++++-----------
 .../maven/plugin/coreit/DeprecatedConfigMojo.java  | 13 ++++++++++
 2 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5222MojoDeprecatedParamsTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5222MojoDeprecatedParamsTest.java
index 2e8023dc1..08135e362 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5222MojoDeprecatedParamsTest.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5222MojoDeprecatedParamsTest.java
@@ -35,7 +35,7 @@ public class MavenITmng5222MojoDeprecatedParamsTest
 {
     public MavenITmng5222MojoDeprecatedParamsTest()
     {
-        super( "[3.9.0,)" );
+        super( "[4.0.0-alpha-1,)" );
     }
 
     /**
@@ -107,13 +107,13 @@ public class MavenITmng5222MojoDeprecatedParamsTest
         List<String> warnLines = findDeprecationWarning( logLines );
 
         assertTrue( warnLines.remove(
-            "[WARNING]   Parameter 'deprecatedParam2' (user property 'config.deprecatedParam2') is deprecated: No reason given" ) );
+            "[WARNING] Parameter 'deprecatedParam2' (user property 'config.deprecatedParam2') is deprecated: No reason given" ) );
 
         assertTrue( warnLines.remove(
-            "[WARNING]   Parameter 'deprecatedArray' (user property 'config.deprecatedArray') is deprecated: deprecated array" ) );
+            "[WARNING] Parameter 'deprecatedArray' (user property 'config.deprecatedArray') is deprecated: deprecated array" ) );
 
         assertTrue( warnLines.remove(
-            "[WARNING]   Parameter 'deprecatedList' (user property 'config.deprecatedList') is deprecated: deprecated list" ) );
+            "[WARNING] Parameter 'deprecatedList' (user property 'config.deprecatedList') is deprecated: deprecated list" ) );
 
         assertTrue( "Not verified line: " + warnLines, warnLines.isEmpty() );
 
@@ -171,34 +171,34 @@ public class MavenITmng5222MojoDeprecatedParamsTest
         List<String> warnLines = findDeprecationWarning( logLines );
 
         assertTrue( warnLines.remove(
-            "[WARNING]   Parameter 'deprecatedParam' is deprecated: I'm deprecated param" ) );
+            "[WARNING] Parameter 'deprecatedParam' is deprecated: I'm deprecated param" ) );
 
         assertTrue( warnLines.remove(
-            "[WARNING]   Parameter 'deprecatedParam2' (user property 'config.deprecatedParam2') is deprecated: No reason given" ) );
+            "[WARNING] Parameter 'deprecatedParam2' (user property 'config.deprecatedParam2') is deprecated: No reason given" ) );
 
         assertTrue( warnLines.remove(
-            "[WARNING]   Parameter 'deprecatedParamWithDefaultConstant' is deprecated: deprecated with constant value" ) );
+            "[WARNING] Parameter 'deprecatedParamWithDefaultConstant' is deprecated: deprecated with constant value" ) );
 
         assertTrue( warnLines.remove(
-            "[WARNING]   Parameter 'deprecatedParamWithDefaultEvaluate' is deprecated: deprecated with evaluate value" ) );
+            "[WARNING] Parameter 'deprecatedParamWithDefaultEvaluate' is deprecated: deprecated with evaluate value" ) );
 
         assertTrue( warnLines.remove(
-            "[WARNING]   Parameter 'deprecatedArray' (user property 'config.deprecatedArray') is deprecated: deprecated array" ) );
+            "[WARNING] Parameter 'deprecatedArray' (user property 'config.deprecatedArray') is deprecated: deprecated array" ) );
 
         assertTrue( warnLines.remove(
-            "[WARNING]   Parameter 'deprecatedArrayWithDefaults' is deprecated: deprecated array" ) );
+            "[WARNING] Parameter 'deprecatedArrayWithDefaults' is deprecated: deprecated array" ) );
 
         assertTrue( warnLines.remove(
-            "[WARNING]   Parameter 'deprecatedList' (user property 'config.deprecatedList') is deprecated: deprecated list" ) );
+            "[WARNING] Parameter 'deprecatedList' (user property 'config.deprecatedList') is deprecated: deprecated list" ) );
 
         assertTrue( warnLines.remove(
-            "[WARNING]   Parameter 'deprecatedListWithDefaults' is deprecated: deprecated list" ) );
+            "[WARNING] Parameter 'deprecatedListWithDefaults' is deprecated: deprecated list" ) );
 
         assertTrue( warnLines.remove(
-            "[WARNING]   Parameter 'deprecatedProperties' is deprecated: deprecated properties" ) );
+            "[WARNING] Parameter 'deprecatedProperties' is deprecated: deprecated properties" ) );
 
         assertTrue( warnLines.remove(
-            "[WARNING]   Parameter 'deprecatedMap' is deprecated: deprecated map" ));
+            "[WARNING] Parameter 'deprecatedMap' is deprecated: deprecated map" ));
 
         assertTrue( "Not verified line: " + warnLines, warnLines.isEmpty() );
 
@@ -238,7 +238,7 @@ public class MavenITmng5222MojoDeprecatedParamsTest
 
     private List<String> findDeprecationWarning( List<String> logLines )
     {
-        Pattern pattern = Pattern.compile( "\\[WARNING] {3}Parameter .* is deprecated:.*" );
+        Pattern pattern = Pattern.compile( "\\[WARNING] Parameter .* is deprecated:.*" );
         List<String> result = new ArrayList<>();
         for ( String line : logLines )
         {
diff --git a/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/DeprecatedConfigMojo.java b/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/DeprecatedConfigMojo.java
index ec21875ca..873995bf6 100644
--- a/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/DeprecatedConfigMojo.java
+++ b/core-it-support/core-it-plugins/maven-it-plugin-configuration/src/main/java/org/apache/maven/plugin/coreit/DeprecatedConfigMojo.java
@@ -24,6 +24,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
+import org.apache.maven.artifact.Artifact;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugins.annotations.LifecyclePhase;
@@ -47,6 +48,18 @@ public class DeprecatedConfigMojo
     @Parameter( defaultValue = "${basedir}", readonly = true )
     private File basedir;
 
+    /**
+     * @deprecated bean read only
+     */
+    @Parameter(  defaultValue = "${project.artifact}", readonly = true )
+    private Artifact deprecatedBeanReadOnly;
+
+    /**
+     * @deprecated bean
+     */
+    @Parameter(  defaultValue = "${project.artifact}" )
+    private Artifact deprecatedBean;
+
     /**
      * The path to the properties file into which to save the mojo configuration.
      */