Repository navigation
Conversation
SelectiveJarResource.copyTo creates META-INF while copying entries such as META-INF/maven/.../pom.xml, then wrote MANIFEST.MF with Files.createDirectory. That throws FileAlreadyExistsException when the directory already exists, so jetty:run and jetty:start fail on a WAR overlay. Files.createDirectories succeeds when META-INF is a directory and still fails when that path is a file. Signed-off-by: arimu1 <19286898+arimu1@users.noreply.github.com>
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.
Fixes #16131
SelectiveJarResource.copyTounpacks WAR overlays forjetty:runandjetty:start. Copying an entry such asMETA-INF/maven/.../pom.xmlalready createsMETA-INF. The manifest was then written withFiles.createDirectory, which throwsFileAlreadyExistsExceptionwhen that directory exists. Jetty 9–11 usedFile.mkdir()for this step.Files.createDirectoriescreatesMETA-INFwhen it is missing, succeeds when it is already a directory, and throwsFileAlreadyExistsExceptionwhen that path is a file.On
jetty-12.1.xthe class isjetty-core/jetty-maven/src/main/java/org/eclipse/jetty/maven/SelectiveJarResource.java. The ee9, ee10, and ee11TestSelectiveJarResourceclasses call that shared class. The regression test is on the ee10 plugin, which is the module in the report.Test
TestSelectiveJarResource.testCopyToWithManifestAndMavenDescriptorbuilds a JAR that containsMANIFEST.MFandMETA-INF/maven/com.example/demo/pom.xml, callscopyTo, and checks that both files exist.Ran only that method on Temurin 21 against
jetty-mavenand its dependencies:Before the fix: 1 test, 1 failure (
FileAlreadyExistsExceptiononMETA-INFfromFiles.createDirectoryinSelectiveJarResource.copyTo).After the fix: 1 test found, 1 successful, 0 failed, 0 skipped.