diff --git a/.gitmodules b/.gitmodules index d38c67bf7e..0c4f6cc8df 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "m2e-core-tests"] path = m2e-core-tests - url = https://github.com/tesla/m2e-core-tests.git - branch = master + url = https://github.com/HannesWell/m2e-core-tests.git + branch = slf4jInTests diff --git a/m2e-core-tests b/m2e-core-tests index e9d1744d40..44ebb58e71 160000 --- a/m2e-core-tests +++ b/m2e-core-tests @@ -1 +1 @@ -Subproject commit e9d1744d4034dd7117dfe202cc1d31c7d0d33165 +Subproject commit 44ebb58e71a6e32e714349ffb83e6415aadeac38 diff --git a/m2e-maven-runtime/org.eclipse.m2e.maven.runtime/pom.xml b/m2e-maven-runtime/org.eclipse.m2e.maven.runtime/pom.xml index 61efebdad4..250033c5e3 100644 --- a/m2e-maven-runtime/org.eclipse.m2e.maven.runtime/pom.xml +++ b/m2e-maven-runtime/org.eclipse.m2e.maven.runtime/pom.xml @@ -169,9 +169,9 @@ com.google.inject.*;provider=m2e;mandatory:=provider,\ io.takari.*;provider=m2e;mandatory:=provider Import-Package: \ - org.slf4j;resolution:=optional;version="[1.7.0,3.0.0)",\ - org.slf4j.spi;resolution:=optional;version="[1.7.0,3.0.0)",\ - org.slf4j.helpers;resolution:=optional;version="[1.7.0,3.0.0)",\ + org.slf4j;version="[1.7.31,3.0.0)",\ + org.slf4j.spi;version="[1.7.31,3.0.0)",\ + org.slf4j.helpers;version="[1.7.31,3.0.0)",\ javax.inject;version="1.0.0",\ javax.annotation;version="[1.2.0,2.0.0)",\ javax.annotation.sql;version="[1.2.0,2.0.0)",\ diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/Bundles.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/Bundles.java index dde23173e3..93dfd14bad 100644 --- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/Bundles.java +++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/Bundles.java @@ -18,10 +18,11 @@ import java.net.URL; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.LinkedHashSet; import java.util.List; +import java.util.NoSuchElementException; import java.util.Set; -import java.util.stream.Collectors; import org.osgi.framework.Bundle; import org.osgi.framework.BundleException; @@ -38,6 +39,8 @@ * @since 1.5 */ public class Bundles { + private Bundles() { + } private static final Logger log = LoggerFactory.getLogger(Bundles.class); @@ -45,12 +48,18 @@ public static List getClasspathEntries(Bundle bundle) { log.debug("getClasspathEntries(Bundle={})", bundle); Set cp = new LinkedHashSet<>(); if(inDevelopmentMode()) { - cp.addAll(getDevClassPath(bundle.getSymbolicName())); + Collections.addAll(cp, getDevClassPath(bundle.getSymbolicName())); } cp.addAll(parseBundleClasspath(bundle)); List entries = new ArrayList<>(); for(String cpe : cp) { - String entry = getClasspathEntryPath(bundle, ".".equals(cpe) ? "/" : cpe); + String entry; + if(".".equals(cpe)) { + entry = FileLocator.getBundleFileLocation(bundle) + .orElseThrow(() -> new NoSuchElementException("Unable to locate bundle:" + bundle)).toString(); + } else { + entry = getClasspathEntryPath(bundle, cpe); + } if(entry != null) { log.debug("\tEntry:{}", entry); entries.add(entry); @@ -64,7 +73,7 @@ private static List parseBundleClasspath(Bundle bundle) { try { ManifestElement[] cpEntries = ManifestElement.parseHeader(Constants.BUNDLE_CLASSPATH, header); if(cpEntries != null) { - return Arrays.stream(cpEntries).map(ManifestElement::getValue).collect(Collectors.toList()); + return Arrays.stream(cpEntries).map(ManifestElement::getValue).toList(); } } catch(BundleException ex) { log.warn("Could not parse bundle classpath of {}", bundle, ex); @@ -97,12 +106,12 @@ public static String getClasspathEntryPath(Bundle bundle, String cp) { } @SuppressWarnings("restriction") - public static List getDevClassPath(String bundleSymbolicName) { - return Arrays.asList(org.eclipse.core.internal.runtime.DevClassPathHelper.getDevClassPath(bundleSymbolicName)); + private static String[] getDevClassPath(String bundleSymbolicName) { + return org.eclipse.core.internal.runtime.DevClassPathHelper.getDevClassPath(bundleSymbolicName); } @SuppressWarnings("restriction") - public static boolean inDevelopmentMode() { + private static boolean inDevelopmentMode() { return org.eclipse.core.internal.runtime.DevClassPathHelper.inDevelopmentMode(); } }