[MEAR-305] Fix skipClassPathModification setting Class-Path empty - #541
Open
elharo wants to merge 5 commits into
Open
[MEAR-305] Fix skipClassPathModification setting Class-Path empty#541elharo wants to merge 5 commits into
elharo wants to merge 5 commits into
Conversation
When skipClassPathModification is true, the plugin should leave module manifests completely untouched. Previously, existing Class-Path entries were still updated/removed and the modified manifest was written back, potentially setting Class-Path to empty. Now all Class-Path modification logic is wrapped in a check for skipClassPathModification. Fixes #180
Restore v3.1.0 behavior where changeManifestClasspath is only invoked when skinnyWars or skinnyModules is active. Previously, the guard condition allowed modules with null libDir (like EJB modules) to proceed even without any skinny feature enabled, causing unnecessary Class-Path modification and potentially removing EJB client JARs from WAR modules. The guard now requires skinnyModules or (skinnyWars AND (WebModule or null-libDir module)) to proceed. Fixes #179
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.
Adjusts manifest handling when skipClassPathModification=true so Class-Path entries aren’t modified while still ensuring a manifest is written out, addressing the “empty Class-Path” regression referenced in #180.
Changes:
- Update manifest Class-Path handling to skip classpath edits when
skipClassPathModificationis enabled, while still writing the manifest. - Update integration tests/expectations for Class-Path elements in affected IT scenarios.
- Adjust expected Class-Path entries for skinny-wars javaee5 verification.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/main/java/org/apache/maven/plugins/ear/EarMojo.java | Adjusts logic for when manifest classpath is modified and ensures manifest gets written even when skipping modification. |
| src/test/java/org/apache/maven/plugins/ear/it/EarMojoIT.java | Updates expected Class-Path entries in ITs to match the new behavior/inputs. |
| src/it/skinny-wars-javaee5/verify.bsh | Updates expected manifest Class-Path element for a skinny-wars IT verification. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
667
to
670
| final String moduleLibDir = module.getLibDir(); | ||
| if (!((moduleLibDir == null) || skinnyModules || (skinnyWars && module instanceof WebModule))) { | ||
| if (!(skinnyModules || (skinnyWars && (module instanceof WebModule || moduleLibDir == null)))) { | ||
| return; | ||
| } |
Comment on lines
716
to
720
| if (classPath != null) { | ||
| classPathExists = true; | ||
| classPathElements.addAll(Arrays.asList(classPath.getValue().split(" "))); | ||
| } else { | ||
| classPathExists = false; | ||
| classPath = new Attribute("Class-Path", ""); | ||
| } |
Comment on lines
+805
to
+816
| // Write the manifest to disk, preserve timestamp | ||
| FileTime lastModifiedTime = Files.getLastModifiedTime(manifestFile); | ||
| try (BufferedWriter writer = Files.newBufferedWriter( | ||
| manifestFile, | ||
| StandardCharsets.UTF_8, | ||
| StandardOpenOption.WRITE, | ||
| StandardOpenOption.CREATE, | ||
| StandardOpenOption.TRUNCATE_EXISTING)) { | ||
| mf.write(writer); | ||
| } | ||
| Files.setLastModifiedTime(manifestFile, lastModifiedTime); | ||
| removeFromOutdatedResources(manifestFile, outdatedResources); |
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.
Changes
When skipClassPathModification=true:
This ensures manifests are left completely untouched when skipping.
Fixes #180