ensure pour mojo handles winegrower-core presence too (#6)
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 3aa4750..9d59ab7 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -31,7 +31,7 @@
runs-on: ubuntu-latest
strategy:
matrix:
- java: [ '1.8', '11.0.4' ]
+ java: [ '11.0.4' ]
steps:
- name: Clone
uses: actions/checkout@v1
@@ -62,7 +62,7 @@
- name: Set up JDK
uses: actions/setup-java@v1
with:
- java-version: '1.8'
+ java-version: '11.0.4'
- name: Build
run: mvn install -DskipTests ossindex:audit
- name: Remove Snapshots Before Caching
diff --git a/winegrower-extension/winegrower-build/winegrower-maven-plugin/src/main/java/org/apache/winegrower/extension/build/maven/PourMojo.java b/winegrower-extension/winegrower-build/winegrower-maven-plugin/src/main/java/org/apache/winegrower/extension/build/maven/PourMojo.java
index c79be06..ecc0a3b 100644
--- a/winegrower-extension/winegrower-build/winegrower-maven-plugin/src/main/java/org/apache/winegrower/extension/build/maven/PourMojo.java
+++ b/winegrower-extension/winegrower-build/winegrower-maven-plugin/src/main/java/org/apache/winegrower/extension/build/maven/PourMojo.java
@@ -127,9 +127,11 @@
throw new IllegalArgumentException(e);
}
}).collect(toList());
- final boolean excludeParentClasses = jars.stream()
+ final boolean excludeOsgi = jars.stream()
.anyMatch(it -> it.getName().startsWith("org.osgi.") || it.getName().startsWith("osgi."));
- if (excludeParentClasses) {
+ final boolean hasWinegrower = jars.stream()
+ .anyMatch(it -> it.getName().startsWith("winegrower-core"));
+ if (excludeOsgi) {
// add build-common
final File buildCommon = Files.toFile(parent.getResource("org/apache/winegrower/extension/build/common/Run.class"));
try {
@@ -140,15 +142,14 @@
}
return urls.isEmpty() ? parent : new URLClassLoader(
urls.toArray(new URL[0]),
- !excludeParentClasses ? parent : new ClassLoader(parent) {
+ !excludeOsgi || !hasWinegrower ? parent : new ClassLoader(parent) {
@Override
protected Class<?> loadClass(final String name, final boolean resolve) throws ClassNotFoundException {
if (name.startsWith("org.")) {
final String sub = name.substring("org.".length());
if (sub.startsWith("osgi.")) {
throw new ClassNotFoundException(name);
- }
- if (sub.startsWith("apache.")) {
+ } else if (sub.startsWith("apache.")) {
final String apache = sub.substring("apache.".length());
if (apache.startsWith("winegrower.")) {
throw new ClassNotFoundException(name);