[MNG-7264] Convert maven-core default-bindings to Providers (#550)
This change get rids of Plexus components defined in META-INF/plexus/default-bindings.xml and converts them to Providers.
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/DefaultLifecycleMapping.java b/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/DefaultLifecycleMapping.java
index 7c8716c..e1ff314 100644
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/DefaultLifecycleMapping.java
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/DefaultLifecycleMapping.java
@@ -19,10 +19,13 @@
* under the License.
*/
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import static java.util.stream.Collectors.toMap;
+
/**
* DefaultLifecycleMapping
*/
@@ -38,7 +41,28 @@
private Map<String, LifecyclePhase> phases;
/**
- * Populates the lifecycle map from the injected list of lifecycle mappings (if not already done).
+ * Default ctor for plexus compatibility: lifecycles are most commonly defined in Plexus XML, that does field
+ * injection. Still, for Plexus to be able to instantiate this class, default ctor is needed.
+ *
+ * @deprecated Should not be used in Java code.
+ */
+ @Deprecated
+ public DefaultLifecycleMapping()
+ {
+ }
+
+ /**
+ * Ctor to be used in Java code/providers.
+ */
+ public DefaultLifecycleMapping( final List<Lifecycle> lifecycles )
+ {
+ this.lifecycleMap = Collections.unmodifiableMap(
+ lifecycles.stream().collect( toMap( Lifecycle::getId, l -> l ) )
+ );
+ }
+
+ /**
+ * Plexus: Populates the lifecycle map from the injected list of lifecycle mappings (if not already done).
*/
private void initLifecycleMap()
{
@@ -79,6 +103,7 @@
}
}
+ @Override
public Map<String, Lifecycle> getLifecycles()
{
initLifecycleMap();
@@ -86,6 +111,8 @@
return lifecycleMap;
}
+ @Deprecated
+ @Override
public List<String> getOptionalMojos( String lifecycle )
{
return null;
@@ -112,9 +139,9 @@
}
@Deprecated
+ @Override
public Map<String, String> getPhases( String lifecycle )
{
return LifecyclePhase.toLegacyMap( getLifecyclePhases( lifecycle ) );
}
-
}
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
new file mode 100644
index 0000000..11e904b
--- /dev/null
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/providers/EarLifecycleMappingProvider.java
@@ -0,0 +1,83 @@
+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
new file mode 100644
index 0000000..2310b57
--- /dev/null
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/providers/EjbLifecycleMappingProvider.java
@@ -0,0 +1,95 @@
+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
new file mode 100644
index 0000000..2d07f19
--- /dev/null
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/providers/JarLifecycleMappingProvider.java
@@ -0,0 +1,95 @@
+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
new file mode 100644
index 0000000..c01afc7
--- /dev/null
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/providers/MavenPluginLifecycleMappingProvider.java
@@ -0,0 +1,102 @@
+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",
+ // TODO: MNG-6556: Do not upgrade to 3.0.0-M1 is does not install the plugin prefix metadata
+ new LifecyclePhase( "org.apache.maven.plugins:maven-install-plugin:2.5.2:install" )
+ );
+ lifecyclePhases.put(
+ "deploy",
+ // TODO: MNG-6556: Do not upgrade to 3.0.0-M1 is does not install the plugin prefix metadata
+ new LifecyclePhase( "org.apache.maven.plugins:maven-deploy-plugin:2.8.2: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/mapping/providers/PomLifecycleMappingProvider.java
new file mode 100644
index 0000000..3015c13
--- /dev/null
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/providers/PomLifecycleMappingProvider.java
@@ -0,0 +1,71 @@
+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( "pom" )
+@Singleton
+public final class PomLifecycleMappingProvider
+ 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;
+ }
+}
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
new file mode 100644
index 0000000..fa29985
--- /dev/null
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/providers/RarLifecycleMappingProvider.java
@@ -0,0 +1,95 @@
+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
new file mode 100644
index 0000000..121a3f4
--- /dev/null
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/providers/WarLifecycleMappingProvider.java
@@ -0,0 +1,95 @@
+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/resources/META-INF/plexus/default-bindings.xml b/maven-core/src/main/resources/META-INF/plexus/default-bindings.xml
deleted file mode 100644
index 79c62e5..0000000
--- a/maven-core/src/main/resources/META-INF/plexus/default-bindings.xml
+++ /dev/null
@@ -1,318 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-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.
--->
-
-<!--
-
-Mappings to default lifecycle, specific for each packaging.
-
--->
-
-<component-set>
- <components>
- <!--
- | POM
- |-->
- <component>
- <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
- <role-hint>pom</role-hint>
- <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
- <configuration>
- <lifecycles>
- <lifecycle>
- <id>default</id>
- <!-- START SNIPPET: pom-lifecycle -->
- <phases>
- <install>
- org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install
- </install>
- <deploy>
- org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy
- </deploy>
- </phases>
- <!-- END SNIPPET: pom-lifecycle -->
- </lifecycle>
- </lifecycles>
- </configuration>
- </component>
-
- <!--
- | JAR
- |-->
- <component>
- <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
- <role-hint>jar</role-hint>
- <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
- <configuration>
- <lifecycles>
- <lifecycle>
- <id>default</id>
- <!-- START SNIPPET: jar-lifecycle -->
- <phases>
- <process-resources>
- org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources
- </process-resources>
- <compile>
- org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile
- </compile>
- <process-test-resources>
- org.apache.maven.plugins:maven-resources-plugin:3.2.0:testResources
- </process-test-resources>
- <test-compile>
- org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile
- </test-compile>
- <test>
- org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test
- </test>
- <package>
- org.apache.maven.plugins:maven-jar-plugin:3.2.0:jar
- </package>
- <install>
- org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install
- </install>
- <deploy>
- org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy
- </deploy>
- </phases>
- <!-- END SNIPPET: jar-lifecycle -->
- </lifecycle>
- </lifecycles>
- </configuration>
- </component>
-
- <!--
- | EJB
- |-->
- <component>
- <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
- <role-hint>ejb</role-hint>
- <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
- <configuration>
- <lifecycles>
- <lifecycle>
- <id>default</id>
- <!-- START SNIPPET: ejb-lifecycle -->
- <phases>
- <process-resources>
- org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources
- </process-resources>
- <compile>
- org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile
- </compile>
- <process-test-resources>
- org.apache.maven.plugins:maven-resources-plugin:3.2.0:testResources
- </process-test-resources>
- <test-compile>
- org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile
- </test-compile>
- <test>
- org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test
- </test>
- <package>
- org.apache.maven.plugins:maven-ejb-plugin:3.1.0:ejb
- </package>
- <install>
- org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install
- </install>
- <deploy>
- org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy
- </deploy>
- </phases>
- <!-- END SNIPPET: ejb-lifecycle -->
- </lifecycle>
- </lifecycles>
- </configuration>
- </component>
-
- <!--
- | MAVEN PLUGIN
- |-->
- <component>
- <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
- <role-hint>maven-plugin</role-hint>
- <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
- <configuration>
- <lifecycles>
- <lifecycle>
- <id>default</id>
- <!-- START SNIPPET: maven-plugin-lifecycle -->
- <phases>
- <process-resources>
- org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources
- </process-resources>
- <compile>
- org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile
- </compile>
- <process-classes>
- org.apache.maven.plugins:maven-plugin-plugin:3.6.0:descriptor
- </process-classes>
- <process-test-resources>
- org.apache.maven.plugins:maven-resources-plugin:3.2.0:testResources
- </process-test-resources>
- <test-compile>
- org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile
- </test-compile>
- <test>
- org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test
- </test>
- <package>
- org.apache.maven.plugins:maven-jar-plugin:3.2.0:jar,
- org.apache.maven.plugins:maven-plugin-plugin:3.6.0:addPluginArtifactMetadata
- </package>
- <!-- MNG-6556: Do not upgrade to 3.0.0-M1 is does not install the plugin prefix metadata -->
- <install>
- org.apache.maven.plugins:maven-install-plugin:2.5.2:install
- </install>
- <!-- MNG-6556: Do not upgrade to 3.0.0-M1 is does not deploy the plugin prefix metadata -->
- <deploy>
- org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy
- </deploy>
- </phases>
- <!-- END SNIPPET: maven-plugin-lifecycle -->
- </lifecycle>
- </lifecycles>
- </configuration>
- </component>
-
- <!--
- | WAR
- |-->
- <component>
- <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
- <role-hint>war</role-hint>
- <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
- <configuration>
- <lifecycles>
- <lifecycle>
- <id>default</id>
- <!-- START SNIPPET: war-lifecycle -->
- <phases>
- <process-resources>
- org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources
- </process-resources>
- <compile>
- org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile
- </compile>
- <process-test-resources>
- org.apache.maven.plugins:maven-resources-plugin:3.2.0:testResources
- </process-test-resources>
- <test-compile>
- org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile
- </test-compile>
- <test>
- org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test
- </test>
- <package>
- org.apache.maven.plugins:maven-war-plugin:3.3.1:war
- </package>
- <install>
- org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install
- </install>
- <deploy>
- org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy
- </deploy>
- </phases>
- <!-- END SNIPPET: war-lifecycle -->
- </lifecycle>
- </lifecycles>
- </configuration>
- </component>
-
- <!--
- | EAR
- |-->
- <component>
- <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
- <role-hint>ear</role-hint>
- <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
- <configuration>
- <lifecycles>
- <lifecycle>
- <id>default</id>
- <!-- START SNIPPET: ear-lifecycle -->
- <phases>
- <generate-resources>
- org.apache.maven.plugins:maven-ear-plugin:3.1.2:generate-application-xml
- </generate-resources>
- <process-resources>
- org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources
- </process-resources>
- <package>
- org.apache.maven.plugins:maven-ear-plugin:3.1.2:ear
- </package>
- <install>
- org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install
- </install>
- <deploy>
- org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy
- </deploy>
- </phases>
- <!-- END SNIPPET: ear-lifecycle -->
- </lifecycle>
- </lifecycles>
- </configuration>
- </component>
-
- <!--
- | RAR
- |-->
- <component>
- <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
- <role-hint>rar</role-hint>
- <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
- <configuration>
- <lifecycles>
- <lifecycle>
- <id>default</id>
- <!-- START SNIPPET: rar-lifecycle -->
- <phases>
- <process-resources>
- org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources
- </process-resources>
- <compile>
- org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile
- </compile>
- <process-test-resources>
- org.apache.maven.plugins:maven-resources-plugin:3.2.0:testResources
- </process-test-resources>
- <test-compile>
- org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile
- </test-compile>
- <test>
- org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test
- </test>
- <package>
- org.apache.maven.plugins:maven-rar-plugin:2.4:rar
- </package>
- <install>
- org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install
- </install>
- <deploy>
- org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy
- </deploy>
- </phases>
- <!-- END SNIPPET: rar-lifecycle -->
- </lifecycle>
- </lifecycles>
- </configuration>
- </component>
-
- </components>
-</component-set>