You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by ss...@apache.org on 2023/09/15 15:18:16 UTC
[xmlgraphics-fop] branch main updated: FOP-3150: Resolve classpath for binary distribution
This is an automated email from the ASF dual-hosted git repository.
ssteiner pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/xmlgraphics-fop.git
The following commit(s) were added to refs/heads/main by this push:
new 699b56779 FOP-3150: Resolve classpath for binary distribution
699b56779 is described below
commit 699b56779e89d45ae8d8ea517bc7cee57e2f4231
Author: Simon Steiner <ss...@apache.org>
AuthorDate: Fri Sep 15 16:18:01 2023 +0100
FOP-3150: Resolve classpath for binary distribution
---
.../src/main/java/org/apache/fop/cli/Main.java | 26 ++++++++--------------
fop/pom.xml | 1 +
2 files changed, 10 insertions(+), 17 deletions(-)
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 @@
<configuration>
<archive>
<manifest>
+ <addClasspath>true</addClasspath>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<mainClass>org.apache.fop.cli.Main</mainClass>
</manifest>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org