elharo commented on issue #168:
URL: 
https://github.com/apache/maven-ear-plugin/issues/168#issuecomment-5103866741

   I tend to think we should do this for reasons which Gemini is better at 
explaining than I am (though in this case I do personally endorse this 
analysis):
   
   From a build engineering and Maven architecture perspective, this is 
generally an anti-pattern and something that should not be implemented.
   
   Here is why this feature request conflicts with standard Maven practices:
   
       Breaks Profile Encapsulation: Maven profiles are designed to encapsulate 
related build changes. If an EAR module is conditionally included via a 
profile, both the <dependency> and the corresponding <plugin> configuration 
(specifically, the <module> entry) should be defined together within that 
<profile>. Relying on a static plugin configuration to dynamically evaluate the 
presence of dependencies separates the intent from the execution.
   
       Introduces Silent Failures: Build tools should fail fast. If a developer 
explicitly configures a module in the maven-ear-plugin but makes a 
typographical error in the groupId or artifactId, or if a dependency fails to 
resolve from a repository, this proposed feature would cause the plugin to 
silently omit the module from the EAR. This shifts a compile-time build failure 
to a runtime deployment failure, which is significantly harder to debug.
   
       Redundant Complexity: The proposed feature adds logic to the plugin to 
solve a problem that Maven already natively solves through correct POM 
structuring. Using <pluginManagement> or merging configurations within profiles 
handles this exact use case without requiring plugins to conditionally ignore 
their own configurations.
   
   While it might save a few lines of XML in a pom.xml, it compromises the 
deterministic nature of the build. The current behavior—failing the build if a 
configured module lacks a corresponding dependency—is the correct and expected 
behavior for Maven plugins.


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