You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2022/01/06 07:17:35 UTC
[maven] 01/01: [MNG-7264] refactor packaging bindings providers to ease maintenance
This is an automated email from the ASF dual-hosted git repository.
hboutemy pushed a commit to branch MNG-7264
in repository https://gitbox.apache.org/repos/asf/maven.git
commit bcd3d4d5ffe5c72e0ffaa9844619bbc4e45a71b5
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Thu Jan 6 08:17:26 2022 +0100
[MNG-7264] refactor packaging bindings providers to ease maintenance
---
.../providers/EarLifecycleMappingProvider.java | 83 -----------------
.../providers/EjbLifecycleMappingProvider.java | 95 --------------------
.../providers/JarLifecycleMappingProvider.java | 95 --------------------
.../MavenPluginLifecycleMappingProvider.java | 100 ---------------------
.../providers/RarLifecycleMappingProvider.java | 95 --------------------
.../providers/WarLifecycleMappingProvider.java | 95 --------------------
.../AbstractLifecycleMappingProvider.java} | 66 ++++++--------
.../packaging/EarLifecycleMappingProvider.java | 48 ++++++++++
.../packaging/EjbLifecycleMappingProvider.java | 51 +++++++++++
.../packaging/JarLifecycleMappingProvider.java | 51 +++++++++++
.../MavenPluginLifecycleMappingProvider.java | 53 +++++++++++
.../packaging/PomLifecycleMappingProvider.java | 45 ++++++++++
.../packaging/RarLifecycleMappingProvider.java | 51 +++++++++++
.../packaging/WarLifecycleMappingProvider.java | 51 +++++++++++
14 files changed, 378 insertions(+), 601 deletions(-)
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/providers/EarLifecycleMappingProvider.java b/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/providers/EarLifecycleMappingProvider.java
deleted file mode 100644
index 11e904b..0000000
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/providers/EarLifecycleMappingProvider.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package org.apache.maven.lifecycle.mapping.providers;
-
-/*
- * 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.
- */
-
-import java.util.Collections;
-import java.util.HashMap;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping;
-import org.apache.maven.lifecycle.mapping.Lifecycle;
-import org.apache.maven.lifecycle.mapping.LifecycleMapping;
-import org.apache.maven.lifecycle.mapping.LifecyclePhase;
-
-@Named( "ear" )
-@Singleton
-public final class EarLifecycleMappingProvider
- implements Provider<LifecycleMapping>
-{
- private final LifecycleMapping lifecycleMapping;
-
- @Inject
- public EarLifecycleMappingProvider()
- {
- HashMap<String, LifecyclePhase> lifecyclePhases = new HashMap<>();
- lifecyclePhases.put(
- "generate-resources",
- new LifecyclePhase( "org.apache.maven.plugins:maven-ear-plugin:3.1.2:generate-application-xml" )
- );
- lifecyclePhases.put(
- "process-resources",
- new LifecyclePhase( "org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources" )
- );
- lifecyclePhases.put(
- "package",
- new LifecyclePhase( "org.apache.maven.plugins:maven-ear-plugin:3.1.2:ear" )
- );
- lifecyclePhases.put(
- "install",
- new LifecyclePhase( "org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install" )
- );
- lifecyclePhases.put(
- "deploy",
- new LifecyclePhase( "org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy" )
- );
-
- Lifecycle lifecycle = new Lifecycle();
- lifecycle.setId( "default" );
- lifecycle.setLifecyclePhases( Collections.unmodifiableMap( lifecyclePhases ) );
-
- this.lifecycleMapping = new DefaultLifecycleMapping(
- Collections.singletonList(
- lifecycle
- )
- );
- }
-
- @Override
- public LifecycleMapping get()
- {
- return lifecycleMapping;
- }
-}
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/providers/EjbLifecycleMappingProvider.java b/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/providers/EjbLifecycleMappingProvider.java
deleted file mode 100644
index 2310b57..0000000
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/providers/EjbLifecycleMappingProvider.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package org.apache.maven.lifecycle.mapping.providers;
-
-/*
- * 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.
- */
-
-import java.util.Collections;
-import java.util.HashMap;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping;
-import org.apache.maven.lifecycle.mapping.Lifecycle;
-import org.apache.maven.lifecycle.mapping.LifecycleMapping;
-import org.apache.maven.lifecycle.mapping.LifecyclePhase;
-
-@Named( "ejb" )
-@Singleton
-public final class EjbLifecycleMappingProvider
- implements Provider<LifecycleMapping>
-{
- private final LifecycleMapping lifecycleMapping;
-
- @Inject
- public EjbLifecycleMappingProvider()
- {
- HashMap<String, LifecyclePhase> lifecyclePhases = new HashMap<>();
- lifecyclePhases.put(
- "process-resources",
- new LifecyclePhase( "org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources" )
- );
- lifecyclePhases.put(
- "compile",
- new LifecyclePhase( "org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile" )
- );
- lifecyclePhases.put(
- "process-test-resources",
- new LifecyclePhase( "org.apache.maven.plugins:maven-resources-plugin:3.2.0:testResources" )
- );
- lifecyclePhases.put(
- "test-compile",
- new LifecyclePhase( "org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile" )
- );
- lifecyclePhases.put(
- "test",
- new LifecyclePhase( "org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test" )
- );
- lifecyclePhases.put(
- "package",
- new LifecyclePhase( "org.apache.maven.plugins:maven-ejb-plugin:3.1.0:ejb" )
- );
- lifecyclePhases.put(
- "install",
- new LifecyclePhase( "org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install" )
- );
- lifecyclePhases.put(
- "deploy",
- new LifecyclePhase( "org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy" )
- );
-
- Lifecycle lifecycle = new Lifecycle();
- lifecycle.setId( "default" );
- lifecycle.setLifecyclePhases( Collections.unmodifiableMap( lifecyclePhases ) );
-
- this.lifecycleMapping = new DefaultLifecycleMapping(
- Collections.singletonList(
- lifecycle
- )
- );
- }
-
- @Override
- public LifecycleMapping get()
- {
- return lifecycleMapping;
- }
-}
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/providers/JarLifecycleMappingProvider.java b/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/providers/JarLifecycleMappingProvider.java
deleted file mode 100644
index 2d07f19..0000000
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/providers/JarLifecycleMappingProvider.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package org.apache.maven.lifecycle.mapping.providers;
-
-/*
- * 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.
- */
-
-import java.util.Collections;
-import java.util.HashMap;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping;
-import org.apache.maven.lifecycle.mapping.Lifecycle;
-import org.apache.maven.lifecycle.mapping.LifecycleMapping;
-import org.apache.maven.lifecycle.mapping.LifecyclePhase;
-
-@Named( "jar" )
-@Singleton
-public final class JarLifecycleMappingProvider
- implements Provider<LifecycleMapping>
-{
- private final LifecycleMapping lifecycleMapping;
-
- @Inject
- public JarLifecycleMappingProvider()
- {
- HashMap<String, LifecyclePhase> lifecyclePhases = new HashMap<>();
- lifecyclePhases.put(
- "process-resources",
- new LifecyclePhase( "org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources" )
- );
- lifecyclePhases.put(
- "compile",
- new LifecyclePhase( "org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile" )
- );
- lifecyclePhases.put(
- "process-test-resources",
- new LifecyclePhase( "org.apache.maven.plugins:maven-resources-plugin:3.2.0:testResources" )
- );
- lifecyclePhases.put(
- "test-compile",
- new LifecyclePhase( "org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile" )
- );
- lifecyclePhases.put(
- "test",
- new LifecyclePhase( "org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test" )
- );
- lifecyclePhases.put(
- "package",
- new LifecyclePhase( "org.apache.maven.plugins:maven-jar-plugin:3.2.0:jar" )
- );
- lifecyclePhases.put(
- "install",
- new LifecyclePhase( "org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install" )
- );
- lifecyclePhases.put(
- "deploy",
- new LifecyclePhase( "org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy" )
- );
-
- Lifecycle lifecycle = new Lifecycle();
- lifecycle.setId( "default" );
- lifecycle.setLifecyclePhases( Collections.unmodifiableMap( lifecyclePhases ) );
-
- this.lifecycleMapping = new DefaultLifecycleMapping(
- Collections.singletonList(
- lifecycle
- )
- );
- }
-
- @Override
- public LifecycleMapping get()
- {
- return lifecycleMapping;
- }
-}
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/providers/MavenPluginLifecycleMappingProvider.java b/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/providers/MavenPluginLifecycleMappingProvider.java
deleted file mode 100644
index 8ab0883..0000000
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/providers/MavenPluginLifecycleMappingProvider.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package org.apache.maven.lifecycle.mapping.providers;
-
-/*
- * 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.
- */
-
-import java.util.Collections;
-import java.util.HashMap;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping;
-import org.apache.maven.lifecycle.mapping.Lifecycle;
-import org.apache.maven.lifecycle.mapping.LifecycleMapping;
-import org.apache.maven.lifecycle.mapping.LifecyclePhase;
-
-@Named( "maven-plugin" )
-@Singleton
-public final class MavenPluginLifecycleMappingProvider
- implements Provider<LifecycleMapping>
-{
- private final LifecycleMapping lifecycleMapping;
-
- @Inject
- public MavenPluginLifecycleMappingProvider()
- {
- HashMap<String, LifecyclePhase> lifecyclePhases = new HashMap<>();
- lifecyclePhases.put(
- "process-resources",
- new LifecyclePhase( "org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources" )
- );
- lifecyclePhases.put(
- "compile",
- new LifecyclePhase( "org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile" )
- );
- lifecyclePhases.put(
- "process-classes",
- new LifecyclePhase( "org.apache.maven.plugins:maven-plugin-plugin:3.6.0:descriptor" )
- );
- lifecyclePhases.put(
- "process-test-resources",
- new LifecyclePhase( "org.apache.maven.plugins:maven-resources-plugin:3.2.0:testResources" )
- );
- lifecyclePhases.put(
- "test-compile",
- new LifecyclePhase( "org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile" )
- );
- lifecyclePhases.put(
- "test",
- new LifecyclePhase( "org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test" )
- );
- lifecyclePhases.put(
- "package",
- new LifecyclePhase( "org.apache.maven.plugins:maven-jar-plugin:3.2.0:jar,"
- + "org.apache.maven.plugins:maven-plugin-plugin:3.6.0:addPluginArtifactMetadata" )
- );
- lifecyclePhases.put(
- "install",
- new LifecyclePhase( "org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install" )
- );
- lifecyclePhases.put(
- "deploy",
- new LifecyclePhase( "org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy" )
- );
-
- Lifecycle lifecycle = new Lifecycle();
- lifecycle.setId( "default" );
- lifecycle.setLifecyclePhases( Collections.unmodifiableMap( lifecyclePhases ) );
-
- this.lifecycleMapping = new DefaultLifecycleMapping(
- Collections.singletonList(
- lifecycle
- )
- );
- }
-
- @Override
- public LifecycleMapping get()
- {
- return lifecycleMapping;
- }
-}
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/providers/RarLifecycleMappingProvider.java b/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/providers/RarLifecycleMappingProvider.java
deleted file mode 100644
index fa29985..0000000
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/providers/RarLifecycleMappingProvider.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package org.apache.maven.lifecycle.mapping.providers;
-
-/*
- * 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.
- */
-
-import java.util.Collections;
-import java.util.HashMap;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping;
-import org.apache.maven.lifecycle.mapping.Lifecycle;
-import org.apache.maven.lifecycle.mapping.LifecycleMapping;
-import org.apache.maven.lifecycle.mapping.LifecyclePhase;
-
-@Named( "rar" )
-@Singleton
-public final class RarLifecycleMappingProvider
- implements Provider<LifecycleMapping>
-{
- private final LifecycleMapping lifecycleMapping;
-
- @Inject
- public RarLifecycleMappingProvider()
- {
- HashMap<String, LifecyclePhase> lifecyclePhases = new HashMap<>();
- lifecyclePhases.put(
- "process-resources",
- new LifecyclePhase( "org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources" )
- );
- lifecyclePhases.put(
- "compile",
- new LifecyclePhase( "org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile" )
- );
- lifecyclePhases.put(
- "process-test-resources",
- new LifecyclePhase( "org.apache.maven.plugins:maven-resources-plugin:3.2.0:testResources" )
- );
- lifecyclePhases.put(
- "test-compile",
- new LifecyclePhase( "org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile" )
- );
- lifecyclePhases.put(
- "test",
- new LifecyclePhase( "org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test" )
- );
- lifecyclePhases.put(
- "package",
- new LifecyclePhase( "org.apache.maven.plugins:maven-rar-plugin:2.4:rar" )
- );
- lifecyclePhases.put(
- "install",
- new LifecyclePhase( "org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install" )
- );
- lifecyclePhases.put(
- "deploy",
- new LifecyclePhase( "org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy" )
- );
-
- Lifecycle lifecycle = new Lifecycle();
- lifecycle.setId( "default" );
- lifecycle.setLifecyclePhases( Collections.unmodifiableMap( lifecyclePhases ) );
-
- this.lifecycleMapping = new DefaultLifecycleMapping(
- Collections.singletonList(
- lifecycle
- )
- );
- }
-
- @Override
- public LifecycleMapping get()
- {
- return lifecycleMapping;
- }
-}
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/providers/WarLifecycleMappingProvider.java b/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/providers/WarLifecycleMappingProvider.java
deleted file mode 100644
index 121a3f4..0000000
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/providers/WarLifecycleMappingProvider.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package org.apache.maven.lifecycle.mapping.providers;
-
-/*
- * 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.
- */
-
-import java.util.Collections;
-import java.util.HashMap;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping;
-import org.apache.maven.lifecycle.mapping.Lifecycle;
-import org.apache.maven.lifecycle.mapping.LifecycleMapping;
-import org.apache.maven.lifecycle.mapping.LifecyclePhase;
-
-@Named( "war" )
-@Singleton
-public final class WarLifecycleMappingProvider
- implements Provider<LifecycleMapping>
-{
- private final LifecycleMapping lifecycleMapping;
-
- @Inject
- public WarLifecycleMappingProvider()
- {
- HashMap<String, LifecyclePhase> lifecyclePhases = new HashMap<>();
- lifecyclePhases.put(
- "process-resources",
- new LifecyclePhase( "org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources" )
- );
- lifecyclePhases.put(
- "compile",
- new LifecyclePhase( "org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile" )
- );
- lifecyclePhases.put(
- "process-test-resources",
- new LifecyclePhase( "org.apache.maven.plugins:maven-resources-plugin:3.2.0:testResources" )
- );
- lifecyclePhases.put(
- "test-compile",
- new LifecyclePhase( "org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile" )
- );
- lifecyclePhases.put(
- "test",
- new LifecyclePhase( "org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test" )
- );
- lifecyclePhases.put(
- "package",
- new LifecyclePhase( "org.apache.maven.plugins:maven-war-plugin:3.3.1:war" )
- );
- lifecyclePhases.put(
- "install",
- new LifecyclePhase( "org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install" )
- );
- lifecyclePhases.put(
- "deploy",
- new LifecyclePhase( "org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy" )
- );
-
- Lifecycle lifecycle = new Lifecycle();
- lifecycle.setId( "default" );
- lifecycle.setLifecyclePhases( Collections.unmodifiableMap( lifecyclePhases ) );
-
- this.lifecycleMapping = new DefaultLifecycleMapping(
- Collections.singletonList(
- lifecycle
- )
- );
- }
-
- @Override
- public LifecycleMapping get()
- {
- return lifecycleMapping;
- }
-}
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/providers/PomLifecycleMappingProvider.java b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/AbstractLifecycleMappingProvider.java
similarity index 52%
rename from maven-core/src/main/java/org/apache/maven/lifecycle/mapping/providers/PomLifecycleMappingProvider.java
rename to maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/AbstractLifecycleMappingProvider.java
index 3015c13..f58f937 100644
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/providers/PomLifecycleMappingProvider.java
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/AbstractLifecycleMappingProvider.java
@@ -1,4 +1,4 @@
-package org.apache.maven.lifecycle.mapping.providers;
+package org.apache.maven.lifecycle.providers.packaging;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -22,50 +22,40 @@ package org.apache.maven.lifecycle.mapping.providers;
import java.util.Collections;
import java.util.HashMap;
-import javax.inject.Inject;
-import javax.inject.Named;
import javax.inject.Provider;
-import javax.inject.Singleton;
import org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping;
import org.apache.maven.lifecycle.mapping.Lifecycle;
import org.apache.maven.lifecycle.mapping.LifecycleMapping;
import org.apache.maven.lifecycle.mapping.LifecyclePhase;
-@Named( "pom" )
-@Singleton
-public final class PomLifecycleMappingProvider
+/**
+ * Base lifecycle mapping provider, ie per-packaging plugin bindings for {@code default} lifecycle.
+ */
+public abstract class AbstractLifecycleMappingProvider
implements Provider<LifecycleMapping>
{
- private final LifecycleMapping lifecycleMapping;
-
- @Inject
- public PomLifecycleMappingProvider()
- {
- HashMap<String, LifecyclePhase> lifecyclePhases = new HashMap<>();
- lifecyclePhases.put(
- "install",
- new LifecyclePhase( "org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install" )
- );
- lifecyclePhases.put(
- "deploy",
- new LifecyclePhase( "org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy" )
- );
-
- Lifecycle lifecycle = new Lifecycle();
- lifecycle.setId( "default" );
- lifecycle.setLifecyclePhases( Collections.unmodifiableMap( lifecyclePhases ) );
-
- this.lifecycleMapping = new DefaultLifecycleMapping(
- Collections.singletonList(
- lifecycle
- )
- );
- }
-
- @Override
- public LifecycleMapping get()
- {
- return lifecycleMapping;
- }
+ private final LifecycleMapping lifecycleMapping;
+
+ protected AbstractLifecycleMappingProvider( String[] pluginBindings )
+ {
+ HashMap<String, LifecyclePhase> lifecyclePhases = new HashMap<>();
+ int len = pluginBindings.length;
+ for ( int i = 0; i < len; i++ )
+ {
+ lifecyclePhases.put( pluginBindings[i++], new LifecyclePhase( pluginBindings[i] ) );
+ }
+
+ Lifecycle lifecycle = new Lifecycle();
+ lifecycle.setId( "default" );
+ lifecycle.setLifecyclePhases( Collections.unmodifiableMap( lifecyclePhases ) );
+
+ this.lifecycleMapping = new DefaultLifecycleMapping( Collections.singletonList( lifecycle ) );
+ }
+
+ @Override
+ public LifecycleMapping get()
+ {
+ return lifecycleMapping;
+ }
}
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
new file mode 100644
index 0000000..68cb550
--- /dev/null
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/EarLifecycleMappingProvider.java
@@ -0,0 +1,48 @@
+package org.apache.maven.lifecycle.providers.packaging;
+
+/*
+ * 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.
+ */
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+/**
+ * {@code ear} packaging plugins bindings provider for {@code default} lifecycle.
+ */
+@Named( "ear" )
+@Singleton
+public final class EarLifecycleMappingProvider
+ extends AbstractLifecycleMappingProvider
+{
+ 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"
+ };
+
+ @Inject
+ public EarLifecycleMappingProvider()
+ {
+ super( BINDINGS );
+ }
+}
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
new file mode 100644
index 0000000..e2b8f69
--- /dev/null
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/EjbLifecycleMappingProvider.java
@@ -0,0 +1,51 @@
+package org.apache.maven.lifecycle.providers.packaging;
+
+/*
+ * 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.
+ */
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+/**
+ * {@code ejb} packaging plugins bindings provider for {@code default} lifecycle.
+ */
+@Named( "ejb" )
+@Singleton
+public final class EjbLifecycleMappingProvider
+ extends AbstractLifecycleMappingProvider
+{
+ 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"
+ };
+
+ @Inject
+ public EjbLifecycleMappingProvider()
+ {
+ super( BINDINGS );
+ }
+}
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
new file mode 100644
index 0000000..b3811fc
--- /dev/null
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/JarLifecycleMappingProvider.java
@@ -0,0 +1,51 @@
+package org.apache.maven.lifecycle.providers.packaging;
+
+/*
+ * 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.
+ */
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+/**
+ * {@code jar} packaging plugins bindings provider for {@code default} lifecycle.
+ */
+@Named( "jar" )
+@Singleton
+public final class JarLifecycleMappingProvider
+ extends AbstractLifecycleMappingProvider
+{
+ 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"
+ };
+
+ @Inject
+ public JarLifecycleMappingProvider()
+ {
+ super( BINDINGS );
+ }
+}
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
new file mode 100644
index 0000000..9a71ffd
--- /dev/null
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/MavenPluginLifecycleMappingProvider.java
@@ -0,0 +1,53 @@
+package org.apache.maven.lifecycle.providers.packaging;
+
+/*
+ * 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.
+ */
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+/**
+ * {@code maven-plugin} packaging plugins bindings provider for {@code default} lifecycle.
+ */
+@Named( "maven-plugin" )
+@Singleton
+public final class MavenPluginLifecycleMappingProvider
+ extends AbstractLifecycleMappingProvider
+{
+ 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"
+ };
+
+ @Inject
+ public MavenPluginLifecycleMappingProvider()
+ {
+ super( BINDINGS );
+ }
+}
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
new file mode 100644
index 0000000..3847f7d
--- /dev/null
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/PomLifecycleMappingProvider.java
@@ -0,0 +1,45 @@
+package org.apache.maven.lifecycle.providers.packaging;
+
+/*
+ * 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.
+ */
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+/**
+ * {@code pom} packaging plugins bindings provider for {@code default} lifecycle.
+ */
+@Named( "pom" )
+@Singleton
+public final class PomLifecycleMappingProvider
+ extends AbstractLifecycleMappingProvider
+{
+ 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"
+ };
+
+ @Inject
+ public PomLifecycleMappingProvider()
+ {
+ super( BINDINGS );
+ }
+}
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
new file mode 100644
index 0000000..89d97e5
--- /dev/null
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/RarLifecycleMappingProvider.java
@@ -0,0 +1,51 @@
+package org.apache.maven.lifecycle.providers.packaging;
+
+/*
+ * 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.
+ */
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+/**
+ * {@code rar} packaging plugins bindings provider for {@code default} lifecycle.
+ */
+@Named( "rar" )
+@Singleton
+public final class RarLifecycleMappingProvider
+ extends AbstractLifecycleMappingProvider
+{
+ 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"
+ };
+
+ @Inject
+ public RarLifecycleMappingProvider()
+ {
+ super( BINDINGS );
+ }
+}
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
new file mode 100644
index 0000000..cd4d092
--- /dev/null
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/WarLifecycleMappingProvider.java
@@ -0,0 +1,51 @@
+package org.apache.maven.lifecycle.providers.packaging;
+
+/*
+ * 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.
+ */
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+/**
+ * {@code war} packaging plugins bindings provider for {@code default} lifecycle.
+ */
+@Named( "war" )
+@Singleton
+public final class WarLifecycleMappingProvider
+ extends AbstractLifecycleMappingProvider
+{
+ 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"
+ };
+
+ @Inject
+ public WarLifecycleMappingProvider()
+ {
+ super( BINDINGS );
+ }
+}