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

   ### Problem
   
   When a Maven extension contributes user properties via the 
`PropertyContributor` SPI (e.g., `nisse.jgit.dynamicVersion` from the 
[Nisse](https://github.com/maveniverse/nisse) extension), these properties are 
**not interpolated** in the consumer POM for projects with 
`<packaging>pom</packaging>`.
   
   The installed/deployed POM contains dangling `${nisse.jgit.dynamicVersion}` 
references in `<dependencyManagement>` entries, making the BOM unusable by 
downstream consumers.
   
   This works correctly with Maven 3.9.x (which uses a different mechanism) and 
with Maven 4's `<packaging>bom</packaging>` (which routes through `buildBom()` 
using the effective model). Only `<packaging>pom</packaging>` is affected.
   
   ### Root Cause
   
   `DefaultConsumerPomBuilder.buildPom()` uses `result.getRawModel()` — the 
uninterpolated raw model. While CI-friendly version properties (`${revision}`, 
`${sha1}`, `${changelist}`) are handled by `replaceCiFriendlyVersion`, 
extension-contributed user properties are not interpolated at all.
   
   The `buildBom()` path uses `result.getEffectiveModel()` (fully interpolated) 
and works correctly. But `buildPom()` preserves the parent reference and uses 
the raw model, assuming consumers can resolve `${...}` through the parent 
chain. Extension-contributed properties are **not** part of any POM or parent 
chain — they only exist as user properties during the build session.
   
   ### Reproducer
   
   See [maveniverse/nisse#208](https://github.com/maveniverse/nisse/issues/208) 
for a full reproducer project. Summary:
   
   A multi-module project where a POM-packaged BOM module uses 
`${nisse.jgit.dynamicVersion}` in `<dependencyManagement>` versions:
   
   ```xml
   <dependencyManagement>
     <dependencies>
       <dependency>
         <groupId>com.example</groupId>
         <artifactId>common</artifactId>
         <version>${nisse.jgit.dynamicVersion}</version>
       </dependency>
     </dependencies>
   </dependencyManagement>
   ```
   
   With Maven 3.9.16: installed POM has `<version>0.1.0-1-main</version>` ✅
   With Maven 4.0.0-rc-6: installed POM has 
`<version>${nisse.jgit.dynamicVersion}</version>` ❌
   
   ### Expected Behavior
   
   The consumer POM should have all property references resolved, regardless of 
whether the property comes from a POM `<properties>` section or from an 
extension's `PropertyContributor`.
   
   ### Proposed Fix
   
   In `buildPom()`, interpolate version references in `<dependencyManagement>` 
and `<dependencies>` using the effective model's resolved values, similar to 
how `buildBom()` uses `filterToOwnDependencyManagement()`.


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