clafren1 commented on issue #348:
URL: 
https://github.com/apache/maven-antrun-plugin/issues/348#issuecomment-3712316830

   In the open PR, it may not be necessary to do a value comparison between the 
ANT property and the corresponding Maven property, if it exists.
   
   Based on a simple test, it doesn't seem possible to override a Maven 
property from the antrun plugin, even with the [`<local>` 
task](https://ant.apache.org/manual/Tasks/local.html).
   
   This sample POM demonstrates the immutable behavior:
   ```
   <?xml version="1.0" encoding="UTF-8"?>
   <project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
     <modelVersion>4.0.0</modelVersion>
     <groupId>my.groupId</groupId>
     <artifactId>my-artifactId</artifactId>
     <version>1.0</version>
     <packaging>pom</packaging>
     <properties>
       <some.property>maven</some.property>
     </properties>
     <build>
       <plugins>
         <plugin>
           <artifactId>maven-antrun-plugin</artifactId>
           <version>3.2.0</version>
           <executions>
             <execution>
               <id>print-property</id>
               <phase>verify</phase>
               <goals>
                 <goal>run</goal>
               </goals>
               <configuration>
                 <target>
                   <echo level="info">some.property (maven): 
${some.property}</echo>
                   <property name="some.property" value="ant"/>
                   <echo level="info">some.property (ant): 
${some.property}</echo>
                   <local name="some.property"/>
                   <property name="some.property" value="local"/>
                   <echo level="info">some.property (local): 
${some.property}</echo>
                 </target>
               </configuration>
             </execution>
           </executions>
         </plugin>
       </plugins>
     </build>
   </project>
   ```
   
   The console output from running `mvn clean verify` with Maven 3.9.11 is:
   ```
   [INFO]      [echo] some.property (maven): maven
   [INFO]      [echo] some.property (ant): maven
   [INFO]      [echo] some.property (local): maven
   ```
   
   `some.property` is defined as a POM property and its value remains constant 
despite the `<property>` & `<local>` ANT tasks.
   
   Alternative ways to remove the unwanted warnings could be:
   - revert the log message back to debug, as the log level change had no 
obvious link to the limitation that needed to be documented in the original 
issue
   - completely ignore ANT properties that are also Maven properties during the 
export step, as their values can not be changed with this plugin


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