[ https://issues.apache.org/jira/browse/GROOVY-11706?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17997087#comment-17997087 ]
Jochen Theodorou commented on GROOVY-11706: ------------------------------------------- to isolate lib loader and transform loader you need to use this constructor https://github.com/apache/groovy/blob/6ebd888f76a077c85294e6e01b6e2479dfc809cb/src/main/java/org/codehaus/groovy/control/CompilationUnit.java#L177 Afaik FileSystemCompiler does use a different constructor resulting in using null for the transform loader and then the same as the lib loader should be used. But both loaders should still have to get their groovy-lib classes from the same groovy version and the same loader. > How to run Groovy compiler via class loader without altering thread context > classloader? > ---------------------------------------------------------------------------------------- > > Key: GROOVY-11706 > URL: https://issues.apache.org/jira/browse/GROOVY-11706 > Project: Groovy > Issue Type: Question > Components: Compiler > Reporter: Xiaotian Ma > Priority: Major > > When using direct reflection access to the main method of the > FileSystemCompiler class, some transformer classes do not seem to load > correctly. (The error is: Could not find class for Transformation Processor > org.codehaus.groovy.transform.trait.TraitASTTransformation declared by > groovy.transform.Trait) > My original requirement was to use code instead of accessing multiple Groovy > compilers simultaneously from the command line. Since different versions > cannot coexist, I need to use classLoader to isolate them. -- This message was sent by Atlassian Jira (v8.20.10#820010)