maven icon indicating copy to clipboard operation
maven copied to clipboard

New feature custom plugin configuration

Open yuehcw opened this issue 1 year ago • 1 comments

Introduction This PR introduces the "Custom Plugin Configuration Profiles" feature, which enhances the flexibility and maintainability of plugin management in Maven projects. By enabling users to define multiple configurations for a single plugin within the POM file, this feature caters to different environments or use cases without duplicating the entire POM file.

Motivation Current Maven configurations apply globally and statically to projects, lacking the flexibility needed for different build environments or specific use cases. This limitation makes it cumbersome to manage builds that require different configurations for the same project.

Changes Proposed

  • Profiles Section: Addition of a new section in the POM file for defining custom plugin configurations.
  • Profile Activation: Implementation of a mechanism to activate profiles based on conditions such as environment variables or system properties. This allows for dynamic configuration changes at build time without altering the POM structure for different scenarios.

Detailed Design

  1. POM File Changes: Introduce a section within the POM file. Each profile will have a unique ID and specified activation conditions.
  2. Activation Mechanism: Users can activate a profile using the Maven command line, for example: mvn clean install -Denv=dev.

Benefits

  • Flexibility: Enables tailored plugin configurations for different environments directly within the POM file.
  • Maintainability: Reduces complexity and enhances clarity by isolating environment-specific configurations.
  • Backward Compatibility: Ensures existing projects remain unaffected. Profiles are optional and only processed if defined.

Compatibility This feature is designed to be backward compatible. Existing projects without defined profiles will operate as usual without any modification to their current behavior.

yuehcw avatar Jun 11 '24 20:06 yuehcw

Hi, I'm not sure I link the description to the code:

  • code enables profiles as -P today but introducing yet another flag and tests are unrelated to that feature :thinking:
  • you can already have multiple plugin configurations either with profiles/properties or with executions if you need it in the same build

Can you provide a test showing the behavior you want please?

rmannibucau avatar Jun 12 '24 05:06 rmannibucau

I really don't understand this PR. Profiles are already defined in the POM, and can already be activated using user properties... Closing this PR. @yuehcw please reopen if you want to provide more information

gnodet avatar Aug 26 '24 21:08 gnodet