diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/providers/CleanLifecycleProvider.java b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/CleanLifecycleProvider.java index 937bfc87e1..4b72b5ee26 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/providers/CleanLifecycleProvider.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/CleanLifecycleProvider.java @@ -31,27 +31,34 @@ import javax.inject.Singleton; import org.apache.maven.lifecycle.Lifecycle; import org.apache.maven.lifecycle.mapping.LifecyclePhase; +/** + * {@code clean} lifecycle provider. + */ @Named( "clean" ) @Singleton public final class CleanLifecycleProvider implements Provider { + private static final String LIFECYCLE_ID = "clean"; + + private static final String[] PHASES = { + "pre-clean", + "clean", + "post-clean" + }; + private final Lifecycle lifecycle; @Inject public CleanLifecycleProvider() { - HashMap phases = new HashMap<>(); - phases.put( "clean", new LifecyclePhase( "org.apache.maven.plugins:maven-clean-plugin:3.1.0:clean" ) ); + HashMap defaultBindings = new HashMap<>(); + defaultBindings.put( "clean", new LifecyclePhase( "org.apache.maven.plugins:maven-clean-plugin:3.1.0:clean" ) ); this.lifecycle = new Lifecycle( - "clean", - Collections.unmodifiableList( Arrays.asList( - "pre-clean", - "clean", - "post-clean" - ) ), - Collections.unmodifiableMap( phases ) + LIFECYCLE_ID, + Collections.unmodifiableList( Arrays.asList( PHASES ) ), + Collections.unmodifiableMap( defaultBindings ) ); } diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/providers/DefaultLifecycleProvider.java b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/DefaultLifecycleProvider.java index 56c032b76b..29d54836a7 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/providers/DefaultLifecycleProvider.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/DefaultLifecycleProvider.java @@ -29,44 +29,51 @@ import javax.inject.Singleton; import org.apache.maven.lifecycle.Lifecycle; +/** + * {@code default} lifecycle provider. + */ @Named( "default" ) @Singleton public final class DefaultLifecycleProvider implements Provider { + private static final String LIFECYCLE_ID = "default"; + + private static final String[] PHASES = { + "validate", + "initialize", + "generate-sources", + "process-sources", + "generate-resources", + "process-resources", + "compile", + "process-classes", + "generate-test-sources", + "process-test-sources", + "generate-test-resources", + "process-test-resources", + "test-compile", + "process-test-classes", + "test", + "prepare-package", + "package", + "pre-integration-test", + "integration-test", + "post-integration-test", + "verify", + "install", + "deploy" + }; + private final Lifecycle lifecycle; @Inject public DefaultLifecycleProvider() { this.lifecycle = new Lifecycle( - "default", - Collections.unmodifiableList( Arrays.asList( - "validate", - "initialize", - "generate-sources", - "process-sources", - "generate-resources", - "process-resources", - "compile", - "process-classes", - "generate-test-sources", - "process-test-sources", - "generate-test-resources", - "process-test-resources", - "test-compile", - "process-test-classes", - "test", - "prepare-package", - "package", - "pre-integration-test", - "integration-test", - "post-integration-test", - "verify", - "install", - "deploy" - ) ), - null + LIFECYCLE_ID, + Collections.unmodifiableList( Arrays.asList( PHASES ) ), + null // no global plugin bindings for default lifecycle: they are defined per-packaging in separate providers ); } diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/providers/SiteLifecycleProvider.java b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/SiteLifecycleProvider.java index 1453f03324..d7ff5631d7 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/providers/SiteLifecycleProvider.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/SiteLifecycleProvider.java @@ -31,29 +31,36 @@ import javax.inject.Singleton; import org.apache.maven.lifecycle.Lifecycle; import org.apache.maven.lifecycle.mapping.LifecyclePhase; +/** + * {@code site} lifecycle provider. + */ @Named( "site" ) @Singleton public final class SiteLifecycleProvider implements Provider { + private static final String LIFECYCLE_ID = "site"; + + private static final String[] PHASES = { + "pre-site", + "site", + "post-site", + "site-deploy" + }; + private final Lifecycle lifecycle; @Inject public SiteLifecycleProvider() { - HashMap phases = new HashMap<>(); - phases.put( "site", new LifecyclePhase( "org.apache.maven.plugins:maven-site-plugin:3.9.1:site" ) ); - phases.put( "site-deploy", new LifecyclePhase( "org.apache.maven.plugins:maven-site-plugin:3.9.1:deploy" ) ); + HashMap defaultBindings = new HashMap<>(); + defaultBindings.put( "site", new LifecyclePhase( "org.apache.maven.plugins:maven-site-plugin:3.9.1:site" ) ); + defaultBindings.put( "site-deploy", new LifecyclePhase( "org.apache.maven.plugins:maven-site-plugin:3.9.1:deploy" ) ); this.lifecycle = new Lifecycle( - "site", - Collections.unmodifiableList( Arrays.asList( - "pre-site", - "site", - "post-site", - "site-deploy" - ) ), - Collections.unmodifiableMap( phases ) + LIFECYCLE_ID, + Collections.unmodifiableList( Arrays.asList( PHASES ) ), + Collections.unmodifiableMap( defaultBindings ) ); } diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/providers/WrapperLifecycleProvider.java b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/WrapperLifecycleProvider.java index 619d50220d..b88dcc1b84 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/providers/WrapperLifecycleProvider.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/providers/WrapperLifecycleProvider.java @@ -19,6 +19,7 @@ package org.apache.maven.lifecycle.providers; * under the License. */ +import java.util.Arrays; import java.util.Collections; import java.util.HashMap; @@ -30,23 +31,33 @@ import javax.inject.Singleton; import org.apache.maven.lifecycle.Lifecycle; import org.apache.maven.lifecycle.mapping.LifecyclePhase; +/** + * {@code wrapper} lifecycle provider. + */ @Named( "wrapper" ) @Singleton public final class WrapperLifecycleProvider implements Provider { + private static final String LIFECYCLE_ID = "wrapper"; + + private static final String[] PHASES = + { + "wrapper" + }; + private final Lifecycle lifecycle; @Inject public WrapperLifecycleProvider() { - HashMap phases = new HashMap<>(); - phases.put( "wrapper", new LifecyclePhase( "org.apache.maven.plugins:maven-wrapper-plugin:3.1.0:wrapper" ) ); + HashMap defaultBindings = new HashMap<>(); + defaultBindings.put( "wrapper", new LifecyclePhase( "org.apache.maven.plugins:maven-wrapper-plugin:3.1.0:wrapper" ) ); this.lifecycle = new Lifecycle( - "wrapper", - Collections.singletonList( "wrapper" ), - Collections.unmodifiableMap( phases ) + LIFECYCLE_ID, + Collections.unmodifiableList( Arrays.asList( PHASES ) ), + Collections.unmodifiableMap( defaultBindings ) ); }