Skip to content

Commit

Permalink
Set context classloader (closes #186)
Browse files Browse the repository at this point in the history
  • Loading branch information
keeganwitt committed Jan 3, 2021
1 parent c859b74 commit 2fd4dc8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ protected Object setupCompilerConfiguration(final File compileOutputDirectory, f
invokeMethod(findMethod(importCustomizerClass, "addStaticStar", String.class), importCustomizer, "org.codehaus.groovy.control.customizers.builder.CompilerCustomizationBuilder");
List compilationCustomizers = (List) invokeMethod(findMethod(compilerConfigurationClass, "getCompilationCustomizers"), shellCompilerConfiguration);
compilationCustomizers.add(importCustomizer);
Object shell = invokeConstructor(findConstructor(groovyShellClass, bindingClass, compilerConfigurationClass), binding, shellCompilerConfiguration);
Object shell = invokeConstructor(findConstructor(groovyShellClass, ClassLoader.class, bindingClass, compilerConfigurationClass), classWrangler.getClassLoader(), binding, shellCompilerConfiguration);
if (getLog().isDebugEnabled()) {
getLog().debug("Using configuration script " + configScript + " for compilation.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public class ClassWrangler {
public ClassWrangler(final List<?> classpath, final ClassLoader parentClassLoader, final Log pluginLog) throws MalformedURLException {
log = pluginLog;
classLoader = createNewClassLoader(classpath, parentClassLoader);
Thread.currentThread().setContextClassLoader(classLoader);
}

/**
Expand Down

0 comments on commit 2fd4dc8

Please sign in to comment.