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

   ### Affected version
   
   4.0.0-rc-4
   
   ### Bug description
   
   # Changes to ${revision} in profiles do not propagate to the final project 
version
   
   ## Expected behavior
   When the POM references <version>${revision}</version>, the resolved value 
of ${revision} should determine the project version.
   
   ## Observed behavior
   ${revision} is resolved correctly, but its value is not applied to the final 
project version.
   
   ## Steps to reproduce
   Execute the provided pom.xml file
   
   
   ### Case 1: No profile activated
   Expected final version includes "+dev"
   ```
   mvn clean
   ...
   [INFO] Building m4-demo-revision 0.2.0+dev
   ...
   baseVersion    : 0.2.0
   revision       : 0.2.0+dev
   project.version: 0.2.0+dev
   version        : 0.2.0+dev
   ```
   
   
   
   ### Case 2: Release profile activated
   Expected final version is only baseVersion without "+dev"
   ```
   mvn clean -PreleaseBuild
   ...
   [INFO] Building m4-demo-revision 0.2.0+dev
   ...
   baseVersion    : 0.2.0
   revision       : 0.2.0
   project.version: 0.2.0+dev
   version        : 0.2.0+dev
   ```
   
   
   ### Case 3: Manipulation profile activated (setting ${version} directly)
   ${version} is set directly and the change is applied, but it still does not 
affect the final project version
   ```
   mvn clean -PmanipulateVersion
   ...
   [INFO] Building m4-demo-revision 0.2.0+dev
   ...
   baseVersion    : 0.2.0
   revision       : 0.2.0+dev
   project.version: 0.2.0+dev
   version        : 0.2.0
   ```
   
   Note: This is not the intended use case, but it illustrates the difference 
between the variable resolution phase and the phase where the project version 
is applied, showing that runtime changes to variables may not propagate to the 
final version.
   
   ## Environment
   Maven : 4.0.0-rc-4 (bed0f8174bf728978f86fac533aa38a9511f3872)
   Java  : 25.0.0, Azul Systems, Inc.
   Locale: en_DE, UTF-8
   OS    : macOS 15.6.1 (aarch64)
   
   ## Related Issue
   This behavior was also observed during Maven 4.0.0-rc-3 evaluation
   
   [MNG-8694] Version not augmentable during runtime in Maven 4 as it was in 
Maven 3 (#10394)
   
   ## Demonstration pom.xml file
   ```
   <project
     xmlns="http://maven.apache.org/POM/4.1.0";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://maven.apache.org/POM/4.1.0 
http://maven.apache.org/xsd/maven-4.1.0.xsd";
     root="true">
     <modelVersion>4.1.0</modelVersion>
   
     <groupId>de.g667.m4-demo</groupId>
     <artifactId>m4-demo-revision</artifactId>
     <version>${revision}</version>
     <packaging>pom</packaging>
     
     <properties>
       <baseVersion>0.2.0</baseVersion>
       <revision>${baseVersion}+dev</revision>
     </properties>
     
     <profiles>
       <profile>
         <id>releaseBuild</id>
         <properties>
           <revision>${baseVersion}</revision>
         </properties>
         <build>
           <plugins>
             <plugin>
               <groupId>com.github.ekryd.echo-maven-plugin</groupId>
               <artifactId>echo-maven-plugin</artifactId>
               <executions>
                 <execution>
                   <id>reportReleaseProfile</id>
                   <goals>
                     <goal>echo</goal>
                   </goals>
                   <phase>clean[1]</phase>
                   <configuration>
                     <message>
                       Release profile activated
          Expected Version: 0.2.0
                     </message>
                   </configuration>
                 </execution>
               </executions>
             </plugin>
           </plugins>
         </build>
       </profile>
       
       <profile>
         <id>manipulateVersion</id>
         <properties>
           <version>${baseVersion}</version>
         </properties>
         <build>
           <plugins>
             <plugin>
               <groupId>com.github.ekryd.echo-maven-plugin</groupId>
               <artifactId>echo-maven-plugin</artifactId>
               <executions>
                 <execution>
                   <id>reportReleaseProfile</id>
                   <goals>
                     <goal>echo</goal>
                   </goals>
                   <phase>clean[1]</phase>
                   <configuration>
                     <message>
                       Manipulating version
          Expected Version: 0.2.0
                     </message>
                   </configuration>
                 </execution>
               </executions>
             </plugin>
           </plugins>
         </build>
       </profile>
     </profiles>
   
     <build>
       <pluginManagement>
         <plugins>
           <plugin>
             <groupId>com.github.ekryd.echo-maven-plugin</groupId>
             <artifactId>echo-maven-plugin</artifactId>
             <version>2.1.0</version>
           </plugin>
           <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-clean-plugin</artifactId>
             <version>4.0.0-beta-2</version>
           </plugin>
         </plugins>
       </pluginManagement>
   
       <plugins>
         <plugin>
           <groupId>com.github.ekryd.echo-maven-plugin</groupId>
           <artifactId>echo-maven-plugin</artifactId>
           <executions>
             <execution>
               <id>reportVersions</id>
               <goals>
                 <goal>echo</goal>
               </goals>
               <phase>clean[2]</phase>
               <configuration>
                 <message>
          baseVersion    : ${baseVersion}
          revision       : ${revision}
          project.version: ${project.version}
          version        : ${version}
                 </message>
               </configuration>
             </execution>
           </executions>
         </plugin>
       </plugins>
     </build>
   
   </project>
   ```
   
   


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