aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2015-05-13 16:20:23 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2015-05-13 16:20:35 +0200
commitaaf1d2f100350ea95e6dfaa34bd001075d2e2584 (patch)
tree91ee3f1e8aad3ae280e3fe231bce4b738d2e62c0 /sonar-batch
parenta0b334f10eedb58bb5bbcf1fbf05054e93927988 (diff)
downloadsonarqube-aaf1d2f100350ea95e6dfaa34bd001075d2e2584.tar.gz
sonarqube-aaf1d2f100350ea95e6dfaa34bd001075d2e2584.zip
SONAR-6517 use thread context classloader as base classloader on batch side
Diffstat (limited to 'sonar-batch')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchPluginLoader.java41
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/GlobalContainer.java3
2 files changed, 42 insertions, 2 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchPluginLoader.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchPluginLoader.java
new file mode 100644
index 00000000000..5831491e991
--- /dev/null
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchPluginLoader.java
@@ -0,0 +1,41 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.batch.bootstrap;
+
+import org.sonar.api.BatchSide;
+import org.sonar.core.platform.PluginExploder;
+import org.sonar.core.platform.PluginLoader;
+
+/**
+ * The {@link PluginLoader} on batch side requires to use thread context
+ * classloader as base classloader in order to support plugins like Groovy
+ * (at least its version 1.1).
+ */
+@BatchSide
+public class BatchPluginLoader extends PluginLoader {
+ public BatchPluginLoader(PluginExploder exploder) {
+ super(exploder);
+ }
+
+ @Override
+ protected ClassLoader baseClassloader() {
+ return Thread.currentThread().getContextClassLoader();
+ }
+}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/GlobalContainer.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/GlobalContainer.java
index 2b84c018c17..f24fe52fbe8 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/GlobalContainer.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/GlobalContainer.java
@@ -55,7 +55,6 @@ import org.sonar.core.persistence.SemaphoreUpdater;
import org.sonar.core.persistence.SemaphoresImpl;
import org.sonar.core.platform.ComponentContainer;
import org.sonar.core.platform.PluginInfo;
-import org.sonar.core.platform.PluginLoader;
import org.sonar.core.platform.PluginRepository;
import org.sonar.core.purge.PurgeProfiler;
import org.sonar.core.rule.CacheRuleFinder;
@@ -99,7 +98,7 @@ public class GlobalContainer extends ComponentContainer {
add(
// plugins
BatchPluginRepository.class,
- PluginLoader.class,
+ BatchPluginLoader.class,
BatchPluginExploder.class,
BatchPluginPredicate.class,
ExtensionInstaller.class,