mthmulders commented on a change in pull request #651:
URL: https://github.com/apache/maven/pull/651#discussion_r779474475
##########
File path:
maven-core/src/main/java/org/apache/maven/lifecycle/providers/packaging/AbstractLifecycleMappingProvider.java
##########
@@ -22,50 +22,40 @@
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 )
Review comment:
If I'm not mistaken, all plugin bindings are a one-to-one mapping of
phase -> plugin (see subclasses). Why not change this parameter to a
`Map<String, String>`, and have subclasses pass the mapping as a `Map<String,
String>`? It feels as if a `String[]` (where each consecutive two elements form
a "pair") is the wrong abstraction in this case.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]