hboutemy commented on a change in pull request #651:
URL: https://github.com/apache/maven/pull/651#discussion_r779733342



##########
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:
       previously, everything was pure XML parsing: Tamás switched to Provider 
code, but still using old `new LifecyclePhase( String )` that parses (and 
splits on comma if there are multiple bindings).
   So we're going step by step from Plexus XML to perfectly maintainable code 
(and maintainable code will match the documentation objective: code before this 
PR is just not readable for documentation, then is not maintainable either = 
what is even more important than documentation)




-- 
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]


Reply via email to