This is an automated email from the ASF dual-hosted git repository. cstamas pushed a commit to branch drop-default-bindings.xml in repository https://gitbox.apache.org/repos/asf/maven.git
commit 9ec3f5164c713004bce6cd3de09910878adcd31e Author: Tamas Cservenak <ta...@cservenak.net> AuthorDate: Thu Sep 23 12:48:15 2021 +0200 Convert maven-core default-bindings to Providers This change get rids of another set of Plexus components defined in XML. --- .../lifecycle/mapping/LifecycleMappingImpl.java | 62 ++++ .../providers/EarLifecycleMappingProvider.java | 83 ++++++ .../providers/EjbLifecycleMappingProvider.java | 95 ++++++ .../providers/JarLifecycleMappingProvider.java | 95 ++++++ .../MavenPluginLifecycleMappingProvider.java | 102 +++++++ .../providers/PomLifecycleMappingProvider.java | 71 +++++ .../providers/RarLifecycleMappingProvider.java | 95 ++++++ .../providers/WarLifecycleMappingProvider.java | 95 ++++++ .../resources/META-INF/plexus/default-bindings.xml | 318 --------------------- 9 files changed, 698 insertions(+), 318 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/LifecycleMappingImpl.java b/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/LifecycleMappingImpl.java new file mode 100644 index 0000000..362606f --- /dev/null +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/LifecycleMappingImpl.java @@ -0,0 +1,62 @@ +package org.apache.maven.lifecycle.mapping; + +/* + * 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.List; +import java.util.Map; + +import static java.util.stream.Collectors.toMap; + +/** + * Alternate implementation of {@link LifecycleMapping} as default one is too much plexus-suited. + */ +public final class LifecycleMappingImpl + implements LifecycleMapping +{ + private final Map<String, Lifecycle> lifecycles; + + public LifecycleMappingImpl( final List<Lifecycle> lifecycles ) + { + this.lifecycles = Collections.unmodifiableMap( + lifecycles.stream().collect( toMap( Lifecycle::getId, l -> l ) ) + ); + } + + @Override + public Map<String, Lifecycle> getLifecycles() + { + return lifecycles; + } + + @Deprecated + @Override + public List<String> getOptionalMojos( final String lifecycle ) + { + return null; + } + + @Deprecated + @Override + public Map<String, String> getPhases( final String lifecycle ) + { + return null; + } +} 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..8bee455 --- /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.Lifecycle; +import org.apache.maven.lifecycle.mapping.LifecycleMapping; +import org.apache.maven.lifecycle.mapping.LifecycleMappingImpl; +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 LifecycleMappingImpl( + 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..37ab6d7 --- /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.Lifecycle; +import org.apache.maven.lifecycle.mapping.LifecycleMapping; +import org.apache.maven.lifecycle.mapping.LifecycleMappingImpl; +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 LifecycleMappingImpl( + 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..afd10b1 --- /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.Lifecycle; +import org.apache.maven.lifecycle.mapping.LifecycleMapping; +import org.apache.maven.lifecycle.mapping.LifecycleMappingImpl; +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 LifecycleMappingImpl( + 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..0b9f133 --- /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.Lifecycle; +import org.apache.maven.lifecycle.mapping.LifecycleMapping; +import org.apache.maven.lifecycle.mapping.LifecycleMappingImpl; +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 LifecycleMappingImpl( + 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..63990fb --- /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.Lifecycle; +import org.apache.maven.lifecycle.mapping.LifecycleMapping; +import org.apache.maven.lifecycle.mapping.LifecycleMappingImpl; +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 LifecycleMappingImpl( + 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..6670ee5 --- /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.Lifecycle; +import org.apache.maven.lifecycle.mapping.LifecycleMapping; +import org.apache.maven.lifecycle.mapping.LifecycleMappingImpl; +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 LifecycleMappingImpl( + 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..86b1155 --- /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.Lifecycle; +import org.apache.maven.lifecycle.mapping.LifecycleMapping; +import org.apache.maven.lifecycle.mapping.LifecycleMappingImpl; +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 LifecycleMappingImpl( + 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>