Skip to content

Commit 699b567

Browse files
FOP-3150: Resolve classpath for binary distribution
1 parent 7f01c67 commit 699b567

File tree

2 files changed

+10
-17
lines changed

2 files changed

+10
-17
lines changed

fop-core/src/main/java/org/apache/fop/cli/Main.java

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.net.URL;
2828
import java.security.AccessController;
2929
import java.security.PrivilegedAction;
30+
import java.util.ArrayList;
3031
import java.util.List;
3132

3233
import org.apache.commons.io.IOUtils;
@@ -62,22 +63,18 @@ public static URL[] getJARList() throws MalformedURLException {
6263
} else {
6364
buildDir = new File(baseDir, "build");
6465
}
65-
File fopJar = new File(buildDir, "fop.jar");
66-
if (!fopJar.exists()) {
67-
fopJar = new File(baseDir, "fop.jar");
68-
}
69-
if (!fopJar.exists()) {
70-
throw new RuntimeException("fop.jar not found in directory: "
71-
+ baseDir.getAbsolutePath() + " (or below)");
72-
}
73-
List jars = new java.util.ArrayList();
74-
jars.add(fopJar.toURI().toURL());
75-
File[] files;
66+
List jars = new ArrayList();
7667
FileFilter filter = new FileFilter() {
7768
public boolean accept(File pathname) {
7869
return pathname.getName().endsWith(".jar");
7970
}
8071
};
72+
File[] files = buildDir.listFiles(filter);
73+
if (files != null) {
74+
for (File file : files) {
75+
jars.add(file.toURI().toURL());
76+
}
77+
}
8178
File libDir = new File(baseDir, "lib");
8279
if (!libDir.exists()) {
8380
libDir = baseDir;
@@ -97,12 +94,7 @@ public boolean accept(File pathname) {
9794
}
9895
}
9996
}
100-
URL[] urls = (URL[])jars.toArray(new URL[jars.size()]);
101-
/*
102-
for (int i = 0, c = urls.length; i < c; i++) {
103-
System.out.println(urls[i]);
104-
}*/
105-
return urls;
97+
return (URL[])jars.toArray(new URL[jars.size()]);
10698
}
10799

108100
/**

fop/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
<configuration>
4848
<archive>
4949
<manifest>
50+
<addClasspath>true</addClasspath>
5051
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
5152
<mainClass>org.apache.fop.cli.Main</mainClass>
5253
</manifest>

0 commit comments

Comments
 (0)