diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/QuarkusCompiler.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/QuarkusCompiler.java index 51472ee12c0fe..5f7e30d5ed4fd 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/dev/QuarkusCompiler.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/QuarkusCompiler.java @@ -5,6 +5,7 @@ import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; +import java.nio.file.FileSystems; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayDeque; @@ -23,6 +24,7 @@ import io.quarkus.bootstrap.app.CuratedApplication; import io.quarkus.bootstrap.app.QuarkusBootstrap; +import io.quarkus.fs.util.FileSystemProviders; import io.quarkus.maven.dependency.ResolvedDependency; import io.quarkus.paths.PathCollection; @@ -74,7 +76,6 @@ public QuarkusCompiler(CuratedApplication application, : context.getDevModeRunnerJarFile().getCanonicalPath(); while (!toParse.isEmpty()) { Path path = toParse.poll(); - URI uri = path.toUri(); File file = path.toFile(); String s = file.getAbsolutePath(); if (!parsedFiles.contains(s)) { @@ -82,9 +83,9 @@ public QuarkusCompiler(CuratedApplication application, if (!file.exists()) { continue; } - if (uri.getScheme().equals("file")) { + if (path.getFileSystem() == FileSystems.getDefault()) { classPathElements.add(file); - } else if (uri.getScheme().equals("jar")) { + } else if (path.getFileSystem().provider() == FileSystemProviders.ZIP_PROVIDER) { // skip adding the dev mode runner jar to the classpath to prevent // hitting a bug in JDK - https://bugs.openjdk.java.net/browse/JDK-8232170 // which causes the programmatic java file compilation to fail. @@ -156,10 +157,10 @@ public void setupSourceCompilationContext(DevModeContext context, Set clas + "'. It is advised that this module be compiled before launching dev mode"); return; } - compilationUnit.getSourcePaths().forEach(sourcePath -> { + for (Path sourcePath : compilationUnit.getSourcePaths()) { final String srcPathStr = sourcePath.toString(); if (this.compilationContexts.containsKey(srcPathStr)) { - return; + continue; } this.compilationContexts.put(srcPathStr, new CompilationProvider.Context( @@ -175,7 +176,7 @@ public void setupSourceCompilationContext(DevModeContext context, Set clas context.getTargetJvmVersion(), context.getCompilerPluginArtifacts(), context.getCompilerPluginsOptions())); - }); + } } } diff --git a/core/runtime/src/main/java/io/quarkus/runtime/util/ClassPathUtils.java b/core/runtime/src/main/java/io/quarkus/runtime/util/ClassPathUtils.java index a5e0b0e4ef9f6..3782c79581be0 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/util/ClassPathUtils.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/util/ClassPathUtils.java @@ -128,9 +128,11 @@ public static R processAsPath(URL url, Function function) { throw new RuntimeException("Failed to create a URL for '" + file.substring(0, exclam) + "'", e); } try (FileSystem jarFs = ZipUtils.newFileSystem(jar)) { - Path localPath = jarFs.getPath("/"); + Path localPath; if (exclam >= 0) { - localPath = localPath.resolve(file.substring(exclam + 1)); + localPath = jarFs.getPath(file.substring(exclam + 1)); + } else { + localPath = jarFs.getPath("/"); } return function.apply(localPath); } catch (IOException e) {