diff --git a/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/DefaultOptionHandler.java b/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/DefaultOptionHandler.java index 46fcaf8ec226..2d36ede1cb05 100644 --- a/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/DefaultOptionHandler.java +++ b/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/DefaultOptionHandler.java @@ -154,7 +154,9 @@ public boolean consume(ArgumentQueue args) { if (jarFilePathStr == null) { NativeImage.showError(requireValidJarFileMessage); } - handleJarFileArg(nativeImage.canonicalize(Paths.get(jarFilePathStr))); + final Path filePath = nativeImage.canonicalize(Paths.get(jarFilePathStr)); + nativeImage.setJarFilePath(filePath); + handleJarFileArg(filePath); nativeImage.setJarOptionMode(true); return true; case verboseOption: @@ -320,7 +322,6 @@ private void handleJarFileArg(Path filePath) { if (!NativeImage.processJarManifestMainAttributes(filePath, nativeImage::handleMainClassAttribute)) { NativeImage.showError("No manifest in " + filePath); } - nativeImage.addCustomImageClasspath(filePath); } @Override diff --git a/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java b/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java index c2f8d8f5886e..9e8037d70e24 100644 --- a/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java +++ b/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java @@ -253,6 +253,7 @@ private static String oR(OptionKey option) { private boolean diagnostics = false; String diagnosticsDir; private boolean jarOptionMode = false; + private Path jarFilePath; private boolean moduleOptionMode = false; private boolean dryRun = false; private String printFlagsOptionQuery = null; @@ -689,9 +690,18 @@ public void showVerboseMessage(String message) { @Override public boolean isExcluded(Path resourcePath, Path classpathEntry) { + showVerboseMessage(String.format("Attempt to check if resource %s in classpath entry %s should be excluded", resourcePath, classpathEntry)); return excludedConfigs.stream() - .filter(e -> e.jarPattern.matcher(classpathEntry.toString()).find()) - .anyMatch(e -> e.resourcePattern.matcher(resourcePath.toString()).find()); + .filter(e -> regexMatch(classpathEntry, e.jarPattern, "Classpath entry")) + .anyMatch(e -> regexMatch(resourcePath, e.resourcePattern, "Resource path")); + } + + private boolean regexMatch(Path path, Pattern pattern, String prefix) { + final boolean matches = pattern.matcher(path.toString()).find(); + if (verbose) { + showVerboseMessage(String.format("%s %s %s match pattern %s", prefix, path, matches ? "does" : "doesn't", pattern)); + } + return matches; } } @@ -1056,14 +1066,14 @@ static boolean processJarManifestMainAttributes(Path jarFilePath, BiConsumer