Fix integration tests to use correct Maven version instead of hardcoded 2.1-SNAPSHOT#2476
Merged
gnodet merged 8 commits intoapache:masterfrom Jun 24, 2025
Merged
Conversation
Switch default behavior from using build Maven installation to testing the Maven distribution generated by the current build. This eliminates the need for manual version updates during releases. - Remove hardcoded maven-version property - Align its/ and core-it-suite/ versions with parent project - Keep core-it-support/ artifacts at stable 2.1-SNAPSHOT version - Add maven-from-build profile to preserve old behavior - Update documentation for new usage patterns Default: mvn clean test -Prun-its (tests built distribution) Old behavior: mvn clean test -Prun-its,maven-from-build
Add maven-version property to core-it-support/pom.xml that references
the parent version (4.0.0-rc-4-SNAPSHOT) to resolve the dependency
version for maven-executor in maven-it-helper.
This fixes the build error:
'dependencies.dependency.version' for maven-executor must be a valid version but is '${maven-version}'
The integration-tests job needs to use the maven-from-build profile since it downloads and uses the built Maven distribution to run the build. Cannot update the workflow directly due to GitHub security restrictions requiring workflow scope for OAuth apps.
The issue is that the new default behavior expects the distribution at apache-maven/target/ but the CI downloads it as an artifact. The solution is to copy the downloaded distribution to the expected location.
The file was causing RAT (Release Audit Tool) failures due to missing Apache license header. The workflow update information is already documented in the PR description.
Spotless moved the properties section to follow standard POM element order (after modules, before dependencyManagement).
This ensures that the support artifacts use the correct Maven version (4.0.0-rc-4-SNAPSHOT) instead of their own version (2.1-SNAPSHOT) when referencing Maven dependencies like maven-plugin-api and maven-core. The maven-version property is set to the correct Maven version being tested.
- Add maven-version property to its/pom.xml set to 4.0.0-rc-4-SNAPSHOT - Update all Maven dependency management entries to use maven-version property - Add maven-executor to dependency management - Remove duplicate dependency management from core-it-support/pom.xml This ensures that integration test support artifacts use the correct Maven version (4.0.0-rc-4-SNAPSHOT) for Maven dependencies instead of their own version (2.1-SNAPSHOT), fixing dependency resolution issues.
elharo
approved these changes
Jun 18, 2025
| <groupId>org.apache.maven.its</groupId> | ||
| <artifactId>core-its</artifactId> | ||
| <version>2.1-SNAPSHOT</version> | ||
| <version>4.0.0-rc-4-SNAPSHOT</version> |
Contributor
There was a problem hiding this comment.
is there any way this can be parameterized so we don;t have to keep changing it with every version?
Contributor
Author
There was a problem hiding this comment.
Maven 4 can infer the version of the parent. But for Maven 3, it is required (and the project's version itself is inferred from the parent version).
But the goal is to exactly avoid having to update it when releasing, as the release plugin does indeed update all project's version.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The integration tests were using hardcoded Maven version
2.1-SNAPSHOTinstead of dynamically using the version of Maven being tested (4.0.0-rc-4-SNAPSHOT). This caused dependency resolution failures when trying to build the integration test support artifacts:Root Cause
The issue was in Maven property resolution:
its/pom.xml) had dependency management using${project.version}2.1-SNAPSHOT), the${project.version}was evaluated in the context of the child project instead of the parent2.1-SNAPSHOTinstead of4.0.0-rc-4-SNAPSHOTSolution
maven-versionproperty inits/pom.xmlset to4.0.0-rc-4-SNAPSHOT${maven-version}instead of${project.version}maven-executordependency to dependency managementcore-it-support/pom.xmlKey Changes
its/pom.xmlits/core-it-support/pom.xmlmaven-versionpropertyits/core-it-support/maven-it-helper/pom.xmlTesting
✅ Build Test:
mvn install -Prun-its -DskipTestsnow PASSES✅ Dependency Resolution: Maven dependencies correctly resolve to
4.0.0-rc-4-SNAPSHOT✅ No More Errors: No more
2.1-SNAPSHOTdependency resolution failures✅ Integration Test Setup: Build progresses to final step (unpacking Maven distribution)
✅ Support Artifacts: All integration test support artifacts build successfully
Verification
Before (dependency resolution failure):
After (correct dependency resolution):
Impact
This fix ensures that:
4.0.0-rc-4-SNAPSHOT)Files Modified
its/pom.xml- Addedmaven-versionproperty and updated dependency managementits/core-it-support/pom.xml- Removed conflicting dependency managementits/core-it-support/maven-it-helper/pom.xml- Removed explicit Maven dependency versionsFixes dependency resolution issues in integration tests and makes them work correctly with the current Maven version being tested.