From: Simon Steiner Date: Fri, 15 Sep 2023 15:18:01 +0000 (+0100) Subject: FOP-3150: Resolve classpath for binary distribution X-Git-Tag: 2_10~51 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=699b56779e89d45ae8d8ea517bc7cee57e2f4231;p=xmlgraphics-fop.git FOP-3150: Resolve classpath for binary distribution --- diff --git a/fop-core/src/main/java/org/apache/fop/cli/Main.java b/fop-core/src/main/java/org/apache/fop/cli/Main.java index a14d20c78..ca9443ade 100644 --- a/fop-core/src/main/java/org/apache/fop/cli/Main.java +++ b/fop-core/src/main/java/org/apache/fop/cli/Main.java @@ -27,6 +27,7 @@ import java.net.MalformedURLException; import java.net.URL; import java.security.AccessController; import java.security.PrivilegedAction; +import java.util.ArrayList; import java.util.List; import org.apache.commons.io.IOUtils; @@ -62,22 +63,18 @@ public final class Main { } else { buildDir = new File(baseDir, "build"); } - File fopJar = new File(buildDir, "fop.jar"); - if (!fopJar.exists()) { - fopJar = new File(baseDir, "fop.jar"); - } - if (!fopJar.exists()) { - throw new RuntimeException("fop.jar not found in directory: " - + baseDir.getAbsolutePath() + " (or below)"); - } - List jars = new java.util.ArrayList(); - jars.add(fopJar.toURI().toURL()); - File[] files; + List jars = new ArrayList(); FileFilter filter = new FileFilter() { public boolean accept(File pathname) { return pathname.getName().endsWith(".jar"); } }; + File[] files = buildDir.listFiles(filter); + if (files != null) { + for (File file : files) { + jars.add(file.toURI().toURL()); + } + } File libDir = new File(baseDir, "lib"); if (!libDir.exists()) { libDir = baseDir; @@ -97,12 +94,7 @@ public final class Main { } } } - URL[] urls = (URL[])jars.toArray(new URL[jars.size()]); - /* - for (int i = 0, c = urls.length; i < c; i++) { - System.out.println(urls[i]); - }*/ - return urls; + return (URL[])jars.toArray(new URL[jars.size()]); } /** diff --git a/fop/pom.xml b/fop/pom.xml index de896f2ba..5845e1f2c 100644 --- a/fop/pom.xml +++ b/fop/pom.xml @@ -47,6 +47,7 @@ + true true org.apache.fop.cli.Main