You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2020/09/18 06:34:09 UTC
[karaf-winegrower] branch master updated: ensure pour mojo handles
winegrower-core presence too (#6)
This is an automated email from the ASF dual-hosted git repository.
jbonofre pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/karaf-winegrower.git
The following commit(s) were added to refs/heads/master by this push:
new c0c7e66 ensure pour mojo handles winegrower-core presence too (#6)
c0c7e66 is described below
commit c0c7e66f47eb85aee58f7f1bdc1f37b8585674e0
Author: Romain Manni-Bucau <rm...@gmail.com>
AuthorDate: Fri Sep 18 08:34:02 2020 +0200
ensure pour mojo handles winegrower-core presence too (#6)
---
.github/workflows/maven.yml | 4 ++--
.../org/apache/winegrower/extension/build/maven/PourMojo.java | 11 ++++++-----
2 files changed, 8 insertions(+), 7 deletions(-)
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 @@ jobs:
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 @@ jobs:
- 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 @@ public class PourMojo extends AbstractMojo {
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 @@ public class PourMojo extends AbstractMojo {
}
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);