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

   ## Description
   
   Maven 4's stricter validation rejects repositories with uninterpolated 
property expressions in their IDs (e.g., `${eclipseP2RepoId}`). When such 
repositories come from transitive dependency POMs — where the defining property 
is not available — builds fail.
   
   PR #12050 addressed a similar issue for **dependencies** with uninterpolated 
expressions by filtering them in `DefaultArtifactDescriptorReader`. However, 
the same problem exists for **repositories** from transitive dependency POMs, 
which are not currently filtered.
   
   ## Steps to Reproduce
   
   1. Build `apache/opennlp-sandbox` with Maven 4
   2. The `caseditor-corpus-server-plugin` module fails during 
`maven-remote-resources-plugin:3.3.0:process`
   
   ## Error
   
   ```
   Caused by: java.lang.IllegalArgumentException: Invalid RemoteRepositories: 
[central (https://repo.maven.apache.org/maven2, default, releases), 
${eclipseP2RepoId} (https://download.eclipse.org/releases/2022-09/, default, 
releases+snapshots), apache.snapshots (https://repository.apache.org/snapshots, 
default, ...)]
       Suppressed: java.lang.IllegalArgumentException: Not fully interpolated 
remote repository ${eclipseP2RepoId} 
(https://download.eclipse.org/releases/2022-09/, default, releases+snapshots)
   ```
   
   ## Analysis
   
   - The `${eclipseP2RepoId}` repository is NOT defined in the opennlp-sandbox 
project — it comes from a transitive dependency POM
   - The property `eclipseP2RepoId` is defined in the original project context 
but not available when the POM is consumed as a transitive dependency
   - Maven 3 silently accepted uninterpolated repository IDs; Maven 4 rejects 
them
   - PR #12050 filters dependencies with uninterpolated expressions in 
`DefaultArtifactDescriptorReader`, but does NOT filter repositories
   
   ## Proposed Fix
   
   Extend the filtering from PR #12050 to also cover repositories with 
uninterpolated IDs in the `ArtifactDescriptorResult`. In 
`DefaultArtifactDescriptorReader`, after `delegate.populateResult()`, filter 
out repositories where the ID contains `${`:
   
   ```java
   result.getRepositories().removeIf(repo -> {
       if (repo.getId() != null && repo.getId().contains("${")) {
           logger.debug("Filtered repository with uninterpolated ID: {}", repo);
           return true;
       }
       return false;
   });
   ```
   
   ## Related
   
   - PR #12050 — Filters transitive dependencies with uninterpolated expressions
   - PR #12084 — Cherry-pick of #12050 to 4.0.x branch
   - Issue #12049 — Original issue for transitive dependency POMs with 
uninterpolated expressions
   
   _Claude Code 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