Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.m2e.core/META-INF/MANIFEST.MF3
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/MavenPlugin.java19
-rw-r--r--org.eclipse.m2e.logback.configuration/META-INF/p2.inf1
-rw-r--r--org.eclipse.m2e.logback.configuration/src/org/eclipse/m2e/internal/logging/LogPlugin.java8
4 files changed, 27 insertions, 4 deletions
diff --git a/org.eclipse.m2e.core/META-INF/MANIFEST.MF b/org.eclipse.m2e.core/META-INF/MANIFEST.MF
index 10a56c81..0eca3f36 100644
--- a/org.eclipse.m2e.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.m2e.core/META-INF/MANIFEST.MF
@@ -20,7 +20,8 @@ Require-Bundle:
com.ibm.icu;bundle-version="4.0.1",
org.slf4j.api;bundle-version="1.5.11",
com.ning.async-http-client;bundle-version="1.4.1",
- org.jboss.netty;bundle-version="3.2.3"
+ org.jboss.netty;bundle-version="3.2.3",
+ org.eclipse.m2e.logback.configuration;bundle-version="0.13.0";resolution:=optional
Eclipse-LazyStart: true
Bundle-ClassPath: .
Bundle-RequiredExecutionEnvironment: J2SE-1.5,
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/MavenPlugin.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/MavenPlugin.java
index 58db3ee4..a68c80cf 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/MavenPlugin.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/MavenPlugin.java
@@ -13,7 +13,9 @@ package org.eclipse.m2e.core;
import java.io.File;
+import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
import org.osgi.framework.Version;
import org.slf4j.Logger;
@@ -81,7 +83,9 @@ import org.eclipse.m2e.core.repository.IRepositoryRegistry;
* MavenPlugin main plug-in class.
*/
public class MavenPlugin extends Plugin {
- private static final Logger log = LoggerFactory.getLogger(MavenPlugin.class);
+ private static final String M2E_LOGBACK_BUNDLE_ID = "org.eclipse.m2e.logback.configuration";
+
+ private final Logger log;
// preferences
private static final String PREFS_ARCHETYPES = "archetypesInfo.xml"; //$NON-NLS-1$
@@ -132,6 +136,19 @@ public class MavenPlugin extends Plugin {
System.err.println("### executing constructor " + IMavenConstants.PLUGIN_ID); //$NON-NLS-1$
new Throwable().printStackTrace();
}
+
+ Bundle m2eLogbackBundle = Platform.getBundle(M2E_LOGBACK_BUNDLE_ID);
+ if(m2eLogbackBundle != null) {
+ if(m2eLogbackBundle.getState() != Bundle.ACTIVE) {
+ try {
+ m2eLogbackBundle.start(Bundle.START_TRANSIENT);
+ } catch(BundleException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ log = LoggerFactory.getLogger(MavenPlugin.class);
}
public IMaven getMaven() {
diff --git a/org.eclipse.m2e.logback.configuration/META-INF/p2.inf b/org.eclipse.m2e.logback.configuration/META-INF/p2.inf
deleted file mode 100644
index 87f20205..00000000
--- a/org.eclipse.m2e.logback.configuration/META-INF/p2.inf
+++ /dev/null
@@ -1 +0,0 @@
-instructions.configure = setStartLevel(startLevel:1);markStarted(started: true); \ No newline at end of file
diff --git a/org.eclipse.m2e.logback.configuration/src/org/eclipse/m2e/internal/logging/LogPlugin.java b/org.eclipse.m2e.logback.configuration/src/org/eclipse/m2e/internal/logging/LogPlugin.java
index e70f1724..1be9a145 100644
--- a/org.eclipse.m2e.logback.configuration/src/org/eclipse/m2e/internal/logging/LogPlugin.java
+++ b/org.eclipse.m2e.logback.configuration/src/org/eclipse/m2e/internal/logging/LogPlugin.java
@@ -26,8 +26,10 @@ import ch.qos.logback.core.joran.spi.JoranException;
import ch.qos.logback.core.util.StatusPrinter;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.service.datalocation.Location;
public class LogPlugin extends Plugin {
private static final String PLUGIN_ID = "org.eclipse.m2e.logback.configuration"; //$NON-NLS-1$
@@ -54,7 +56,11 @@ public class LogPlugin extends Plugin {
+ System.getProperty(ContextInitializer.CONFIG_FILE_PROPERTY));
return;
}
-
+ Location instanceLocation = Platform.getInstanceLocation();
+ if(!instanceLocation.isSet()) {
+ new Exception("The " + PLUGIN_ID + " bundle was activated before the platform instance location was initialized.");
+ return;
+ }
File stateDir = getStateLocation().toFile();
File configFile = new File(stateDir, "logback." + context.getBundle().getVersion().toString() + ".xml");

Back to the top