hazendaz opened a new issue, #11694:
URL: https://github.com/apache/maven/issues/11694

   ### New feature, improvement proposal
   
   Currently, Maven allows profile activation based on the JDK version using 
the ```<jdk>``` element, which supports version ranges:
   
   ```
   <activation>
       <jdk>[17,)</jdk>
   </activation>
   ```
   
   This works reliably for activating profiles for any compatible JDK, 
including future minor versions.
   
   However, there is no equivalent mechanism for Maven versions.
   
   The current workaround using 
   ```
   <activation>
     <property>
       <name>maven.version</name>
       <value>…</value>
     </property>
   </activation>``` only supports exact string matches. 
   
   For example:
   
   ```
   <activation>
       <property>
           <name>maven.version</name>
           <value>4.0.0-rc-5</value>
       </property>
   </activation>
   ```
   
   This approach is fragile and unmaintainable:
   
   Each new Maven 4 release requires adding a new profile or updating the 
existing one.
   
   Automatic activation for a range of Maven 4 versions is not possible.
   
   It complicates plugin property overrides and build automation.
   
   Proposed improvement:
   Introduce a new activation element <maven> that behaves like <jdk> and 
supports version ranges. Example usage:
   
   ```
   <profile>
       <id>maven4</id>
       <activation>
           <maven>[4,)</maven>
       </activation>
       <properties>
           <!-- overrides for Maven 4 -->
           <clean.plugin>4.0.0-beta-2</clean.plugin>
           <compiler.plugin>4.0.0-beta-4</compiler.plugin>
           <deploy.plugin>4.0.0-beta-2</deploy.plugin>
           <install.plugin>4.0.0-beta-2</install.plugin>
       </properties>
   </profile>
   ```
   
   Benefits:
   
   1. Automatically activates profiles for any future Maven 4.x releases.
   2. Eliminates the need for multiple exact-match profiles.
   3. Simplifies plugin version overrides for Maven 4.
   4. Keeps builds future-proof and reduces maintenance overhead.
   
   This would bring feature parity between JDK and Maven version activation and 
is fully backward-compatible for Maven 3 and existing builds.


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