pn-santos commented on issue #1481:
URL: https://github.com/apache/maven-mvnd/issues/1481#issuecomment-3719332747

   Hi @cstamas I built 794ca63ff25a89ca8c5ee0e694baef5c7ce9ac0c locally:
   ```
   Apache Maven Daemon (mvnd) 1.0.4-SNAPSHOT linux-amd64 native client 
(794ca63ff25a89ca8c5ee0e694baef5c7ce9ac0c)
   Terminal: org.jline.terminal.impl.PosixSysTerminal with pty 
org.jline.terminal.impl.jni.linux.LinuxNativePty
   Apache Maven 3.9.12 (848fbb4bf2d427b72bdb2471c22fced7ebd9a7a1)
   Maven home: /opt/maven-daemon/local/mvn
   Java version: 21.0.2, vendor: GraalVM Community, runtime: 
/opt/java/graalvm-community-openjdk-21.0.2+13.1
   Default locale: en_GB, platform encoding: UTF-8
   OS name: "linux", version: "6.8.0-90-generic", arch: "amd64", family: "unix"
   ```
   
   And it doesn't seem to fix the issue. 
   
   Not sure if it helps, but from what I can tell, the issue happens when 
`properties` that are only referenced in sub-project / child poms are modified.
   
   If I change a `properties` version that is referenced in the pom 
`dependencyManagement` (of that same pom), mvnd seems to pick that up. But if 
the `properties` version is only referenced by the child poms, mvnd seems to 
keep in cache/memory the last time it parsed/built the parent pom and ignore 
the change.
   
   With something like this:
   
   ```xml
     <modules>
       <module>abc</module>
       <module>xyz</module>
     </modules>
   
     <properties>
       <a.version>1.2.3</a.version>
       <b.version>4.5.6</b.version> <!-- only referenced in module xyz pom -->
     <properties>
   
     <dependencyManagement>
       <dependencies>
         <dependency>
           <groupId>org.example</groupId>
           <artifactId>dependency</artifactId>
           <version>${a.version}</version>
           <type>pom</type>
           <scope>import</scope>
         </dependency>
       </dependencies>
     </dependencyManagement>
   ```
   
   If I change `a.version` that is picked up. If I change `b.version` mvnd will 
not pick it up. It will use the `b.version` of the initial build, even if that 
build was not valid. e.g. if the version doesn't exist the first build will 
fail, if I then update the `b.version` to the correct value, the build will 
still fail because it's attempted with the initial invalid version. It only 
after `mvnd` is restarted that the change is picked up.
   
   Also another thing that could be related, in the parent pom of the project 
has a "fixed" version (`1.0`):
   ```xml
     <groupId>com.example</groupId>
     <artifactId>parent-pom</artifactId>
     <packaging>pom</packaging>
     <version>1.0</version>
   ```
   I just tried and it seems that if I use `1.0-SNAPSHOT` the issue doesn't 
happen and any change is picked up.
   
   The reason we use a fixed version is because we never actually publish the 
parent-pom. We flatten all published modules and the parent-pom only defines 
`dependencyManagement`, `profiles` and some `properties`. To avoid having to 
manage the parent pom version (and have to publish it) we opted to use a fixed 
`1.0` value and flatten all published modules, in a way trying to get the 
"consumer pom" behaviour of the upcoming maven 4.0
   
   Still maven doesn't have this issue with the fixed version, only `mvnd`


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