You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by cs...@apache.org on 2022/07/12 12:57:26 UTC

[maven] 01/01: Pull out lifecycle plugin versions

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

cstamas pushed a commit to branch pull-out-lifecycle-plugin-versions
in repository https://gitbox.apache.org/repos/asf/maven.git

commit 836defab7e39fdfb6edd30748ba325eceb9c81c1
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Tue Jul 12 14:56:34 2022 +0200

    Pull out lifecycle plugin versions
    
    To lessen mistake (copy-paste vs forgotten update) but also just to
    make things less redundant. This also makes possible "experimenting"
    much more easier.
---
 .../AbstractLifecycleMappingProvider.java          | 12 +++++++++++
 .../packaging/EarLifecycleMappingProvider.java     | 13 +++++++-----
 .../packaging/EjbLifecycleMappingProvider.java     | 19 ++++++++++--------
 .../packaging/JarLifecycleMappingProvider.java     | 17 ++++++++--------
 .../MavenPluginLifecycleMappingProvider.java       | 23 ++++++++++++----------
 .../packaging/PomLifecycleMappingProvider.java     |  5 +++--
 .../packaging/RarLifecycleMappingProvider.java     | 19 ++++++++++--------
 .../packaging/WarLifecycleMappingProvider.java     | 19 ++++++++++--------
 8 files changed, 78 insertions(+), 49 deletions(-)

diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/AbstractLifecycleMappingProvider.java b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/AbstractLifecycleMappingProvider.java
index fe698d320..3f7202f36 100644
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/AbstractLifecycleMappingProvider.java
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/AbstractLifecycleMappingProvider.java
@@ -37,6 +37,18 @@ import static java.util.Objects.requireNonNull;
 public abstract class AbstractLifecycleMappingProvider
     implements Provider<LifecycleMapping>
 {
+    protected static final String RESOURCES_PLUGIN_VERSION = "3.2.0";
+
+    protected static final String COMPILER_PLUGIN_VERSION = "3.8.1";
+
+    protected static final String SUREFIRE_PLUGIN_VERSION = "3.0.0-M5";
+
+    protected static final String JAR_PLUGIN_VERSION = "3.2.0";
+
+    protected static final String INSTALL_PLUGIN_VERSION = "3.0.0-M1";
+
+    protected static final String DEPLOY_PLUGIN_VERSION = "3.0.0-M2";
+
     private final LifecycleMapping lifecycleMapping;
 
     protected AbstractLifecycleMappingProvider( String[] pluginBindings )
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/EarLifecycleMappingProvider.java b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/EarLifecycleMappingProvider.java
index 336c583fd..5ff943afd 100644
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/EarLifecycleMappingProvider.java
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/EarLifecycleMappingProvider.java
@@ -31,14 +31,17 @@ import javax.inject.Singleton;
 public final class EarLifecycleMappingProvider
     extends AbstractLifecycleMappingProvider
 {
+    private static final String EAR_PLUGIN_VERSION = "3.1.2";
+
     // START SNIPPET: ear
+    @SuppressWarnings( "checkstyle:linelength" )
     private static final String[] BINDINGS =
     {
-        "generate-resources", "org.apache.maven.plugins:maven-ear-plugin:3.1.2:generate-application-xml",
-        "process-resources",  "org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources",
-        "package",            "org.apache.maven.plugins:maven-ear-plugin:3.1.2:ear",
-        "install",            "org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install",
-        "deploy",             "org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy"
+        "generate-resources", "org.apache.maven.plugins:maven-ear-plugin:" + EAR_PLUGIN_VERSION + ":generate-application-xml",
+        "process-resources",  "org.apache.maven.plugins:maven-resources-plugin:" + RESOURCES_PLUGIN_VERSION + ":resources",
+        "package",            "org.apache.maven.plugins:maven-ear-plugin:" + EAR_PLUGIN_VERSION + ":ear",
+        "install",            "org.apache.maven.plugins:maven-install-plugin:" + INSTALL_PLUGIN_VERSION + ":install",
+        "deploy",             "org.apache.maven.plugins:maven-deploy-plugin:" + DEPLOY_PLUGIN_VERSION + ":deploy"
     };
     // END SNIPPET: ear
 
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/EjbLifecycleMappingProvider.java b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/EjbLifecycleMappingProvider.java
index 4f8d414ef..6029c02a5 100644
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/EjbLifecycleMappingProvider.java
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/EjbLifecycleMappingProvider.java
@@ -31,17 +31,20 @@ import javax.inject.Singleton;
 public final class EjbLifecycleMappingProvider
     extends AbstractLifecycleMappingProvider
 {
+    private static final String EJB_PLUGIN_VERSION = "3.1.0";
+
     // START SNIPPET: ejb
+    @SuppressWarnings( "checkstyle:linelength" )
     private static final String[] BINDINGS =
     {
-        "process-resources",      "org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources",
-        "compile",                "org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile",
-        "process-test-resources", "org.apache.maven.plugins:maven-resources-plugin:3.2.0:testResources",
-        "test-compile",           "org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile",
-        "test",                   "org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test",
-        "package",                "org.apache.maven.plugins:maven-ejb-plugin:3.1.0:ejb",
-        "install",                "org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install",
-        "deploy",                 "org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy"
+        "process-resources",      "org.apache.maven.plugins:maven-resources-plugin:" + RESOURCES_PLUGIN_VERSION + ":resources",
+        "compile",                "org.apache.maven.plugins:maven-compiler-plugin:" + COMPILER_PLUGIN_VERSION + ":compile",
+        "process-test-resources", "org.apache.maven.plugins:maven-resources-plugin:" + RESOURCES_PLUGIN_VERSION + ":testResources",
+        "test-compile",           "org.apache.maven.plugins:maven-compiler-plugin:" + COMPILER_PLUGIN_VERSION + ":testCompile",
+        "test",                   "org.apache.maven.plugins:maven-surefire-plugin:" + SUREFIRE_PLUGIN_VERSION + ":test",
+        "package",                "org.apache.maven.plugins:maven-ejb-plugin:" + EJB_PLUGIN_VERSION + ":ejb",
+        "install",                "org.apache.maven.plugins:maven-install-plugin:" + INSTALL_PLUGIN_VERSION + ":install",
+        "deploy",                 "org.apache.maven.plugins:maven-deploy-plugin:" + DEPLOY_PLUGIN_VERSION + ":deploy"
     };
     // END SNIPPET: ejb
     
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/JarLifecycleMappingProvider.java b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/JarLifecycleMappingProvider.java
index 207d4ad65..05bfe98f9 100644
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/JarLifecycleMappingProvider.java
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/JarLifecycleMappingProvider.java
@@ -32,16 +32,17 @@ public final class JarLifecycleMappingProvider
     extends AbstractLifecycleMappingProvider
 {
     // START SNIPPET: jar
+    @SuppressWarnings( "checkstyle:linelength" )
     private static final String[] BINDINGS =
     {
-        "process-resources",      "org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources",
-        "compile",                "org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile",
-        "process-test-resources", "org.apache.maven.plugins:maven-resources-plugin:3.2.0:testResources",
-        "test-compile",           "org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile",
-        "test",                   "org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test",
-        "package",                "org.apache.maven.plugins:maven-jar-plugin:3.2.0:jar",
-        "install",                "org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install",
-        "deploy",                 "org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy"
+        "process-resources",      "org.apache.maven.plugins:maven-resources-plugin:" + RESOURCES_PLUGIN_VERSION + ":resources",
+        "compile",                "org.apache.maven.plugins:maven-compiler-plugin:" + COMPILER_PLUGIN_VERSION + ":compile",
+        "process-test-resources", "org.apache.maven.plugins:maven-resources-plugin:" + RESOURCES_PLUGIN_VERSION + ":testResources",
+        "test-compile",           "org.apache.maven.plugins:maven-compiler-plugin:" + COMPILER_PLUGIN_VERSION + ":testCompile",
+        "test",                   "org.apache.maven.plugins:maven-surefire-plugin:" + SUREFIRE_PLUGIN_VERSION + ":test",
+        "package",                "org.apache.maven.plugins:maven-jar-plugin:" + JAR_PLUGIN_VERSION + ":jar",
+        "install",                "org.apache.maven.plugins:maven-install-plugin:" + INSTALL_PLUGIN_VERSION + ":install",
+        "deploy",                 "org.apache.maven.plugins:maven-deploy-plugin:" + DEPLOY_PLUGIN_VERSION + ":deploy"
     };
     // END SNIPPET: jar
     
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/MavenPluginLifecycleMappingProvider.java b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/MavenPluginLifecycleMappingProvider.java
index 520bd0a1c..90db58165 100644
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/MavenPluginLifecycleMappingProvider.java
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/MavenPluginLifecycleMappingProvider.java
@@ -31,19 +31,22 @@ import javax.inject.Singleton;
 public final class MavenPluginLifecycleMappingProvider
     extends AbstractLifecycleMappingProvider
 {
+    private static final String PLUGIN_PLUGIN_VERSION = "3.6.0";
+
     // START SNIPPET: maven-plugin
+    @SuppressWarnings( "checkstyle:linelength" )
     private static final String[] BINDINGS =
     {
-        "process-resources",      "org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources",
-        "compile",                "org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile",
-        "process-classes",        "org.apache.maven.plugins:maven-plugin-plugin:3.6.0:descriptor",
-        "process-test-resources", "org.apache.maven.plugins:maven-resources-plugin:3.2.0:testResources",
-        "test-compile",           "org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile",
-        "test",                   "org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test",
-        "package",                "org.apache.maven.plugins:maven-jar-plugin:3.2.0:jar,"
-                                + "org.apache.maven.plugins:maven-plugin-plugin:3.6.0:addPluginArtifactMetadata",
-        "install",                "org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install",
-        "deploy",                 "org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy"
+        "process-resources",      "org.apache.maven.plugins:maven-resources-plugin:" + RESOURCES_PLUGIN_VERSION + ":resources",
+        "compile",                "org.apache.maven.plugins:maven-compiler-plugin:" + COMPILER_PLUGIN_VERSION + ":compile",
+        "process-classes",        "org.apache.maven.plugins:maven-plugin-plugin:" + PLUGIN_PLUGIN_VERSION + ":descriptor",
+        "process-test-resources", "org.apache.maven.plugins:maven-resources-plugin:" + RESOURCES_PLUGIN_VERSION + ":testResources",
+        "test-compile",           "org.apache.maven.plugins:maven-compiler-plugin:" + COMPILER_PLUGIN_VERSION + ":testCompile",
+        "test",                   "org.apache.maven.plugins:maven-surefire-plugin:" + SUREFIRE_PLUGIN_VERSION + ":test",
+        "package",                "org.apache.maven.plugins:maven-jar-plugin:" + JAR_PLUGIN_VERSION + ":jar,"
+                                + "org.apache.maven.plugins:maven-plugin-plugin:" + PLUGIN_PLUGIN_VERSION + ":addPluginArtifactMetadata",
+        "install",                "org.apache.maven.plugins:maven-install-plugin:" + INSTALL_PLUGIN_VERSION + ":install",
+        "deploy",                 "org.apache.maven.plugins:maven-deploy-plugin:" + DEPLOY_PLUGIN_VERSION + ":deploy"
     };
     // END SNIPPET: maven-plugin
     
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/PomLifecycleMappingProvider.java b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/PomLifecycleMappingProvider.java
index c6e0e8aae..3237e3c76 100644
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/PomLifecycleMappingProvider.java
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/PomLifecycleMappingProvider.java
@@ -32,10 +32,11 @@ public final class PomLifecycleMappingProvider
     extends AbstractLifecycleMappingProvider
 {
     // START SNIPPET: pom
+    @SuppressWarnings( "checkstyle:linelength" )
     private static final String[] BINDINGS =
     {
-        "install", "org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install",
-        "deploy",  "org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy"
+        "install", "org.apache.maven.plugins:maven-install-plugin:" + INSTALL_PLUGIN_VERSION + ":install",
+        "deploy",  "org.apache.maven.plugins:maven-deploy-plugin:" + DEPLOY_PLUGIN_VERSION + ":deploy"
     };
     // END SNIPPET: pom
     
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/RarLifecycleMappingProvider.java b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/RarLifecycleMappingProvider.java
index d77ddabda..f2e9a64fd 100644
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/RarLifecycleMappingProvider.java
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/RarLifecycleMappingProvider.java
@@ -31,17 +31,20 @@ import javax.inject.Singleton;
 public final class RarLifecycleMappingProvider
     extends AbstractLifecycleMappingProvider
 {
+    private static final String RAR_PLUGIN_VERSION = "2.4";
+
     // START SNIPPET: rar
+    @SuppressWarnings( "checkstyle:linelength" )
     private static final String[] BINDINGS =
     {
-        "process-resources",      "org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources",
-        "compile",                "org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile",
-        "process-test-resources", "org.apache.maven.plugins:maven-resources-plugin:3.2.0:testResources",
-        "test-compile",           "org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile",
-        "test",                   "org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test",
-        "package",                "org.apache.maven.plugins:maven-rar-plugin:2.4:rar",
-        "install",                "org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install",
-        "deploy",                 "org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy"
+        "process-resources",      "org.apache.maven.plugins:maven-resources-plugin:" + RESOURCES_PLUGIN_VERSION + ":resources",
+        "compile",                "org.apache.maven.plugins:maven-compiler-plugin:" + COMPILER_PLUGIN_VERSION + ":compile",
+        "process-test-resources", "org.apache.maven.plugins:maven-resources-plugin:" + RESOURCES_PLUGIN_VERSION + ":testResources",
+        "test-compile",           "org.apache.maven.plugins:maven-compiler-plugin:" + COMPILER_PLUGIN_VERSION + ":testCompile",
+        "test",                   "org.apache.maven.plugins:maven-surefire-plugin:" + SUREFIRE_PLUGIN_VERSION + ":test",
+        "package",                "org.apache.maven.plugins:maven-rar-plugin:" + RAR_PLUGIN_VERSION + ":rar",
+        "install",                "org.apache.maven.plugins:maven-install-plugin:" + INSTALL_PLUGIN_VERSION + ":install",
+        "deploy",                 "org.apache.maven.plugins:maven-deploy-plugin:" + DEPLOY_PLUGIN_VERSION + ":deploy"
     };
     // END SNIPPET: rar
     
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/WarLifecycleMappingProvider.java b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/WarLifecycleMappingProvider.java
index 9e93531f9..55112d995 100644
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/WarLifecycleMappingProvider.java
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/WarLifecycleMappingProvider.java
@@ -31,17 +31,20 @@ import javax.inject.Singleton;
 public final class WarLifecycleMappingProvider
     extends AbstractLifecycleMappingProvider
 {
+    private static final String WAR_PLUGIN_VERSION = "3.3.1";
+
     // START SNIPPET: war
+    @SuppressWarnings( "checkstyle:linelength" )
     private static final String[] BINDINGS =
     {
-        "process-resources",      "org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources",
-        "compile",                "org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile",
-        "process-test-resources", "org.apache.maven.plugins:maven-resources-plugin:3.2.0:testResources",
-        "test-compile",           "org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile",
-        "test",                   "org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test",
-        "package",                "org.apache.maven.plugins:maven-war-plugin:3.3.1:war",
-        "install",                "org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install",
-        "deploy",                 "org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy"
+        "process-resources",      "org.apache.maven.plugins:maven-resources-plugin:" + RESOURCES_PLUGIN_VERSION + ":resources",
+        "compile",                "org.apache.maven.plugins:maven-compiler-plugin:" + COMPILER_PLUGIN_VERSION + ":compile",
+        "process-test-resources", "org.apache.maven.plugins:maven-resources-plugin:" + RESOURCES_PLUGIN_VERSION + ":testResources",
+        "test-compile",           "org.apache.maven.plugins:maven-compiler-plugin:" + COMPILER_PLUGIN_VERSION + ":testCompile",
+        "test",                   "org.apache.maven.plugins:maven-surefire-plugin:" + SUREFIRE_PLUGIN_VERSION + ":test",
+        "package",                "org.apache.maven.plugins:maven-war-plugin:" + WAR_PLUGIN_VERSION + ":war",
+        "install",                "org.apache.maven.plugins:maven-install-plugin:" + INSTALL_PLUGIN_VERSION + ":install",
+        "deploy",                 "org.apache.maven.plugins:maven-deploy-plugin:" + DEPLOY_PLUGIN_VERSION + ":deploy"
     };
     // END SNIPPET: war