Skip to content

Conversation

gnodet
Copy link
Contributor

@gnodet gnodet commented Oct 7, 2025

Backport

This will backport the following commits from master to maven-4.0.x:

Questions ?

Please refer to the Backport tool documentation

…1140)

This commit enables repository URL interpolation in Maven 4 while maintaining
backward compatibility and providing early validation of unresolved expressions.
Repository URLs can now use expressions like ${env.REPO_URL} and ${project.basedir.uri}
which are interpolated during model building.

Key changes:

1. DefaultModelBuilder: Add repository URL interpolation during model building
   - Support for repositories, pluginRepositories, profiles, and distributionManagement
   - Provide basedir, project.basedir, project.basedir.uri, project.rootDirectory,
     and project.rootDirectory.uri properties for interpolation
   - Enable environment variable and project property interpolation in repository URLs

2. DefaultModelValidator: Validate interpolated repository URLs for unresolved expressions
   - Repository URL expressions are interpolated during model building
   - After interpolation, any remaining ${...} expressions cause validation errors
   - Early failure during model validation provides clear error messages

3. CompatibilityFixStrategy: Remove repository disabling logic, replace with
   informational logging for interpolated URLs

4. Add integration tests for repository URL interpolation:
   - Test successful interpolation from environment variables and project properties
   - Test early failure when expressions cannot be resolved during model building

The new approach enables legitimate use cases while providing early, clear error
messages for unresolved expressions during the validate phase rather than later
during repository resolution.

(cherry picked from commit 210dbdc)

# Conflicts:
#	impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java
#	impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelValidator.java
@gnodet gnodet force-pushed the backport/maven-4.0.x/pr-11140 branch from 616d6ea to 0e1faea Compare October 8, 2025 10:00
@gnodet gnodet added bug Something isn't working backport labels Oct 8, 2025
@gnodet gnodet merged commit 4aacaee into apache:maven-4.0.x Oct 8, 2025
20 of 21 checks passed
@github-actions github-actions bot added this to the 4.0.0 milestone Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant