You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/01/06 12:17:19 UTC

[GitHub] [maven] cstamas commented on a change in pull request #651: [MNG-7264] refactor packaging bindings providers to ease maintenance

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



##########
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:
       Goal is "ease of documentation" AFAIU... as before, doco was simply pointing to XML (that was nicely formatted and totally "human readable"), I think Herve plans the same thing here, just have doco point at (trivially simple) class. So while I agree that abstraction seems not the best, keep in mind the reason of this change of his (if am not mistaken). And I agree, Java11 or Guava ImmutableMaps would really help here to build a Map in "readable" way.




-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org