JCRVLT-418 upgrade FastClasspathScanner to be able to deal with java9
modules
This closes #37
git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/commons/filevault-package-maven-plugin/trunk@1875094 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/pom.xml b/pom.xml
index 8e427db..8913270 100644
--- a/pom.xml
+++ b/pom.xml
@@ -446,9 +446,9 @@
<!-- class analyzer -->
<dependency>
- <groupId>io.github.lukehutch</groupId>
- <artifactId>fast-classpath-scanner</artifactId>
- <version>2.0.21</version>
+ <groupId>io.github.classgraph</groupId>
+ <artifactId>classgraph</artifactId>
+ <version>4.8.65</version>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
diff --git a/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/ImportPackageBuilder.java b/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/ImportPackageBuilder.java
index d5e3f24..d4234e6 100644
--- a/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/ImportPackageBuilder.java
+++ b/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/ImportPackageBuilder.java
@@ -16,6 +16,9 @@
*/
package org.apache.jackrabbit.filevault.maven.packaging.impl;
+import static org.apache.commons.io.FileUtils.listFiles;
+import static org.apache.commons.io.FilenameUtils.normalize;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -55,11 +58,8 @@
import aQute.bnd.osgi.Descriptors;
import aQute.bnd.osgi.FileResource;
import aQute.bnd.osgi.Processor;
-import io.github.lukehutch.fastclasspathscanner.FastClasspathScanner;
-import io.github.lukehutch.fastclasspathscanner.scanner.ScanResult;
-
-import static org.apache.commons.io.FileUtils.listFiles;
-import static org.apache.commons.io.FilenameUtils.normalize;
+import io.github.classgraph.ClassGraph;
+import io.github.classgraph.ScanResult;
/**
* The import package builder is used to analyze the classes and dependencies of the project and calculate the
@@ -330,7 +330,8 @@
*/
private void scanClassPath() throws IOException {
try {
- scanResult = new FastClasspathScanner()
+ scanResult = new ClassGraph()
+ .enableAllInfo()
.overrideClassLoaders(getClassLoader())
.scan();
@@ -403,12 +404,12 @@
}
// checking for super classes
- io.github.lukehutch.fastclasspathscanner.scanner.ClassInfo clzInfo = scanResult.getClassNameToClassInfo().get(clazz.getFQN());
+ io.github.classgraph.ClassInfo clzInfo = scanResult.getClassInfo(clazz.getFQN());
if (clzInfo != null) {
- for (String name: clzInfo.getNamesOfImplementedInterfaces()) {
+ for (String name: clzInfo.getInterfaces().getNames()) {
registerPackageReference(info, getPackageName(name));
}
- for (String name: clzInfo.getNamesOfSuperclasses()) {
+ for (String name: clzInfo.getSuperclasses().getNames()) {
registerPackageReference(info, getPackageName(name));
}
}
diff --git a/src/test/java/org/apache/jackrabbit/filevault/maven/packaging/it/CheckSignatureIT.java b/src/test/java/org/apache/jackrabbit/filevault/maven/packaging/it/CheckSignatureIT.java
index ce5d5a6..ec475e5 100644
--- a/src/test/java/org/apache/jackrabbit/filevault/maven/packaging/it/CheckSignatureIT.java
+++ b/src/test/java/org/apache/jackrabbit/filevault/maven/packaging/it/CheckSignatureIT.java
@@ -30,4 +30,15 @@
.setTestProjectDir("/check-signature")
.build();
}
+
+ /**
+ *
+ */
+ @Test
+ public void testJava9Module() throws Exception {
+ new ProjectBuilder()
+ .setTestProjectDir("/check-signature2")
+ .build();
+ }
+
}
diff --git a/src/test/resources/test-projects/check-signature2/pom.xml b/src/test/resources/test-projects/check-signature2/pom.xml
new file mode 100644
index 0000000..6708c3f
--- /dev/null
+++ b/src/test/resources/test-projects/check-signature2/pom.xml
@@ -0,0 +1,62 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <!-- ====================================================================== -->
+ <!-- P R O J E C T D E S C R I P T I O N -->
+ <!-- ====================================================================== -->
+ <groupId>org.apache.jackrabbit.filevault</groupId>
+ <artifactId>package-plugin-test-pkg</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>content-package</packaging>
+ <name>Packaging test</name>
+
+ <build>
+ <plugins>
+ <!-- content package plugin -->
+ <plugin>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>filevault-package-maven-plugin</artifactId>
+ <version>${plugin.version}</version>
+ <extensions>true</extensions>
+ <configuration>
+ <filters>
+ <filter>
+ <root>/apps/bundles</root>
+ </filter>
+ </filters>
+ <packageType>container</packageType>
+ <embeddeds>
+ <embedded>
+ <groupId>com.fasterxml.jackson.jaxrs</groupId>
+ <artifactId>jackson-jaxrs-base</artifactId>
+ </embedded>
+ </embeddeds>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.fasterxml.jackson.jaxrs</groupId>
+ <artifactId>jackson-jaxrs-base</artifactId>
+ <version>2.10.0</version>
+ </dependency>
+ </dependencies>
+</project>