Skip to content

Transitive dependency POMs with uninterpolated repository IDs cause build failures #12086

@gnodet

Description

@gnodet

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 Filter transitive repositories with uninterpolated IDs #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 ${:

result.getRepositories().removeIf(repo -> {
    if (repo.getId() != null && repo.getId().contains("${")) {
        logger.debug("Filtered repository with uninterpolated ID: {}", repo);
        return true;
    }
    return false;
});

Related

Claude Code on behalf of Guillaume Nodet

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions