Add integration test for multi-release JAR detection - #563
Conversation
Adds an integration test that verifies the Multi-Release: true manifest entry is present when META-INF/versions/ files exist in the class output. This test passes on Linux/macOS but fails on Windows due to File.separatorChar mismatch (the prefix check uses backslash on Windows but FileSetManager always returns forward-slash paths). Issue: apache#557
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Adds a Maven Invoker integration test to validate that the built JAR is marked as multi-release (Multi-Release: true) when META-INF/versions/ content is present, improving cross-platform confidence (including Windows).
Changes:
- Added a new Maven Invoker IT project (
MJAR-557-detect-mjar) that packagesMETA-INF/versions/9/...content. - Added a
verify.groovyscript to assertMulti-Releasemanifest attribute is set totrue. - Updated root
pom.xmlexcludes to avoid RAT/header checks on the added plain text fixture.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/it/MJAR-557-detect-mjar/verify.groovy | Verifies the built JAR manifest contains Multi-Release: true. |
| src/it/MJAR-557-detect-mjar/src/main/resources/META-INF/versions/9/test.txt | Adds a META-INF/versions/9/ fixture to trigger MRJAR detection. |
| src/it/MJAR-557-detect-mjar/pom.xml | Defines the IT Maven project that builds a JAR using the plugin under test. |
| src/it/MJAR-557-detect-mjar/invoker.properties | Configures Invoker execution constraints and test description. |
| pom.xml | Excludes the fixture text file from checks (e.g., RAT/license header validation). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def mrjar = new JarFile(jarFile) | ||
| def manifest = mrjar.manifest.mainAttributes | ||
|
|
||
| assert manifest.getValue(Attributes.Name.MULTI_RELEASE) == "true" |
| @@ -0,0 +1 @@ | |||
| Test file for multi-release JAR detection | |||
|
Addressed Copilot review comments:
|
slachiewicz
left a comment
There was a problem hiding this comment.
General looks good.
There are unresolved copilot issues.
Adds an integration test that verifies the
Multi-Release: truemanifest entry is added when the class output containsMETA-INF/versions/files.The detection logic in
AbstractJarMojousesFile.separatorCharto build the path prefix, which matches the platform separator used byDirectoryScanner. This test passes on all platforms (Linux, macOS, Windows).