SLING-11253 - Files other than JAR on the classpath make the plugin throw a ZipException
* filtered the considered artifact list to only contain JAR files
diff --git a/src/main/java/org/apache/sling/maven/jspc/JspcMojo.java b/src/main/java/org/apache/sling/maven/jspc/JspcMojo.java
index 12fd061..b4bd6af 100644
--- a/src/main/java/org/apache/sling/maven/jspc/JspcMojo.java
+++ b/src/main/java/org/apache/sling/maven/jspc/JspcMojo.java
@@ -34,6 +34,7 @@
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.jar.JarFile;
+import java.util.stream.Collectors;
import javax.json.Json;
import javax.json.JsonArrayBuilder;
@@ -577,7 +578,8 @@
loader = new TrackingClassLoader(classPath.toArray(new URL[classPath.size()]), featureSupport.getClassLoader());
} else {
// add artifacts from project
- Set<Artifact> artifacts = project.getArtifacts();
+ Set<Artifact> artifacts = project.getArtifacts().stream().filter(artifact -> "jar".equalsIgnoreCase(artifact.getType())).collect(
+ Collectors.toSet());
for (Artifact a: artifacts) {
final String scope = a.getScope();
if ("provided".equals(scope) || "runtime".equals(scope) || "compile".equals(scope)) {
diff --git a/src/test/resources/jspc-maven-plugin-it-includes/pom.xml b/src/test/resources/jspc-maven-plugin-it-includes/pom.xml
index 4f59ad9..083aacf 100644
--- a/src/test/resources/jspc-maven-plugin-it-includes/pom.xml
+++ b/src/test/resources/jspc-maven-plugin-it-includes/pom.xml
@@ -64,5 +64,11 @@
<artifactId>jspc-maven-plugin-it-deps</artifactId>
<version>0.0.1</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>jspc-maven-plugin-it-deps</artifactId>
+ <version>0.0.1</version>
+ <type>random</type>
+ </dependency>
</dependencies>
</project>
diff --git a/src/test/resources/jspc-maven-plugin-it-includes/repo/org/apache/sling/jspc-maven-plugin-it-deps/0.0.1/jspc-maven-plugin-it-deps-0.0.1.random b/src/test/resources/jspc-maven-plugin-it-includes/repo/org/apache/sling/jspc-maven-plugin-it-deps/0.0.1/jspc-maven-plugin-it-deps-0.0.1.random
new file mode 100644
index 0000000..ed11160
--- /dev/null
+++ b/src/test/resources/jspc-maven-plugin-it-includes/repo/org/apache/sling/jspc-maven-plugin-it-deps/0.0.1/jspc-maven-plugin-it-deps-0.0.1.random
@@ -0,0 +1,19 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+random