gnodet opened a new pull request, #13194:
URL: https://github.com/apache/maven/pull/13194

   ## Summary
   
   `PomInlinerTransformer` fails with `IllegalArgumentException: Cannot inline 
property revision` when a project uses CI-friendly versions (`${revision}` in 
`<version>`) and the property is defined in the POM's own `<properties>` 
section without being passed via `-Drevision=...` on the command line.
   
   Projects affected: `hbase-operator-tools`, `hugegraph-toolchain`, and any 
project that uses CI-friendly versions with a POM-defined default value.
   
   ## Root Cause
   
   `PomInlinerTransformer.injectTransformedArtifacts` resolves version-property 
values exclusively from `session.getConfigProperties()`, which only contains 
CLI `-D` args, system properties, and profile properties. When `revision` is 
defined as a POM property and not overridden via `-D`, it is absent from 
`configProperties`, triggering:
   
   ```
   IllegalArgumentException: Cannot inline property revision
       at 
PomInlinerTransformer.lambda$injectTransformedArtifacts$1(PomInlinerTransformer.java:130)
   ```
   
   ## Fix
   
   When a version property is not in `session.getConfigProperties()`, fall back 
to `project.getProperties()` (the effective project properties, which include 
POM-defined properties). The resolved value is stored in a per-session 
`pomProperties` map (keyed in `session.getData()`, similar to the existing 
`needsInlining` set) so that `replacePom()` can use it — since `replacePom` 
does not have access to the `MavenProject`.
   
   CLI `-D` values continue to take precedence over POM-defined defaults, 
preserving the standard Maven property override order.
   
   ## Test
   
   Added IT `gh-13192-ci-friendly-pom-property`: a multi-module project where 
`<revision>1.0.0</revision>` is defined only in POM properties. The test:
   1. Installs all modules in legacy mode (`-Dmaven.maven3Personality=true`) 
without any `-Drevision` argument (previously this threw 
`IllegalArgumentException`)
   2. Verifies the installed POM contains the literal version `1.0.0` rather 
than the `${revision}` placeholder
   3. Verifies a subsequent partial build (`-pl module-2`) resolves the 
installed artifact correctly
   
   ---
   _Hermès (Claude Sonnet 4.6) on behalf of Guillaume Nodet_
   


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