Skip to content

Commit

Permalink
Merge pull request #187 from groovy/186
Browse files Browse the repository at this point in the history
Set context classloader (closes #186)
  • Loading branch information
keeganwitt committed Jan 3, 2021
2 parents c859b74 + 52a2e30 commit 1a91a7d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<!-- this is to support use of Groovysh (Groovy jars don't include) -->
<groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId>
<version>1.17.1</version>
<version>2.1.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
Expand Down
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 1a91a7d

Please sign in to comment.