use of org.sonarsource.sonarlint.core.client.api.standalone.StandaloneGlobalConfiguration in project sonarlint-intellij by SonarSource.
the class SonarLintEngineFactory method createEngine.
StandaloneSonarLintEngine createEngine() {
/*
* Some components in the container use the context classloader to find resources. For example, the ServiceLoader uses it by default
* to find services declared by some libs.
*/
ClassLoader cl = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
try {
URL[] plugins = loadPlugins();
StandaloneGlobalConfiguration globalConfiguration = StandaloneGlobalConfiguration.builder().setLogOutput(globalLogOutput).setSonarLintUserHome(getSonarLintHome()).setWorkDir(getWorkDir()).addPlugins(plugins).build();
return new StandaloneSonarLintEngineImpl(globalConfiguration);
} catch (Exception e) {
throw new IllegalStateException(e);
} finally {
Thread.currentThread().setContextClassLoader(cl);
}
}
Aggregations