diff --git a/build.gradle b/build.gradle
index 7be56849f5..771c7cdb5f 100644
--- a/build.gradle
+++ b/build.gradle
@@ -187,6 +187,7 @@ project('main') {
compile 'javax.activation:activation:1.1.1'
testCompile 'junit:junit:4.12'
+ testCompile 'org.reflections:reflections:0.9.11'
}
jar {
diff --git a/build.xml b/build.xml
index 67098f42cd..8b2624dda4 100644
--- a/build.xml
+++ b/build.xml
@@ -52,6 +52,7 @@ under the License.
+
@@ -208,7 +209,7 @@ under the License.
-
+
@@ -219,6 +220,17 @@ under the License.
+
+
+
+
+
+
+
+
@@ -420,6 +432,9 @@ under the License.
+
+
+
@@ -582,6 +597,7 @@ under the License.
+
@@ -753,6 +769,9 @@ under the License.
+
+
+
@@ -760,9 +779,13 @@ under the License.
+
+
+
+
diff --git a/src/ooxml/testcases/org/apache/poi/ooxml/util/OOXMLLite.java b/src/ooxml/testcases/org/apache/poi/ooxml/util/OOXMLLite.java
index e17b684d6f..85650ba994 100644
--- a/src/ooxml/testcases/org/apache/poi/ooxml/util/OOXMLLite.java
+++ b/src/ooxml/testcases/org/apache/poi/ooxml/util/OOXMLLite.java
@@ -48,6 +48,7 @@ import org.junit.internal.TextListener;
import org.junit.runner.Description;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
+import org.reflections.Reflections;
/**
* Build a 'lite' version of the ooxml-schemas.jar
@@ -194,19 +195,25 @@ public final class OOXMLLite {
//see what classes from the ooxml-schemas.jar are loaded
System.out.println("Copying classes to " + _destDest);
Map> classes = getLoadedClasses(_ooxmlJar.getName());
+ Set packages = new HashSet<>();
for (Class> cls : classes.values()) {
- String className = cls.getName();
- String classRef = className.replace('.', '/') + ".class";
- File destFile = new File(_destDest, classRef);
- IOUtils.copy(cls.getResourceAsStream('/' + classRef), destFile);
+ copyFile(cls);
+ packages.add(cls.getPackage().getName());
if(cls.isInterface()){
/// Copy classes and interfaces declared as members of this class
for(Class> fc : cls.getDeclaredClasses()){
- className = fc.getName();
- classRef = className.replace('.', '/') + ".class";
- destFile = new File(_destDest, classRef);
- IOUtils.copy(fc.getResourceAsStream('/' + classRef), destFile);
+ copyFile(fc);
+ }
+ }
+ }
+ for (String pkg : packages) {
+ Reflections reflections = new Reflections(pkg);
+ for (Class listClass : reflections.getSubTypesOf(List.class)) {
+ for (Class> compare : classes.values()){
+ if (listClass.getName().startsWith(compare.getName())) {
+ copyFile(listClass);
+ }
}
}
}
@@ -224,6 +231,13 @@ public final class OOXMLLite {
}
}
+ private void copyFile(Class> cls) throws IOException {
+ String className = cls.getName();
+ String classRef = className.replace('.', '/') + ".class";
+ File destFile = new File(_destDest, classRef);
+ IOUtils.copy(cls.getResourceAsStream('/' + classRef), destFile);
+ }
+
private static boolean checkForTestAnnotation(Class> testclass) {
for (Method m : testclass.getDeclaredMethods()) {
if(m.isAnnotationPresent(Test.class)) {