If
groovy.ui.GroovyMain<https://github.com/apache/groovy/blob/master/src/main/groovy/groovy/ui/GroovyMain.java>
passed the current class loader to the new GroovyShell as the parent loader,
continuity could be maintained. Can anyone see a problem with this?
private void processFiles() throws CompilationFailedException, IOException,
URISyntaxException {
GroovyShell groovy = new
GroovyShell(/**/Thread.currentThread().getContextClassLoader(),/**/conf);
setupContextClassLoader(groovy);
private void processOnce() throws CompilationFailedException, IOException,
URISyntaxException {
GroovyShell groovy = new
GroovyShell(/**/Thread.currentThread().getContextClassLoader(),/**/conf);
setupContextClassLoader(groovy);
________________________________
From: Milles, Eric (TR Tech, Content & Ops) <[email protected]>
Sent: Friday, May 17, 2019 11:53 AM
To: [email protected]
Subject: Re: groovy.ui.GroovyMain and groovy.ui.Console classpath arguments
FYI, GroovyStarter creates a RootLoader that is configured by its "--classpath"
arguments. Then runs its "--main" class argument. When groovy.ui.GroovyMain
is that main class, it resets the thread's context class loader from the
RootLoader to a new loader provided by "new GroovyShell(new
CompilerConfiguration(command line processing)).getClassLoader()".
________________________________
From: Milles, Eric (TR Tech, Content & Ops) <[email protected]>
Sent: Friday, May 17, 2019 11:47 AM
To: [email protected]
Subject: groovy.ui.GroovyMain and groovy.ui.Console classpath arguments
Both GroovyMain and Console claim to accept "--classpath" arguments, however
neither class has any processing for them. How are these arguments supported?
Is GroovyMain or Console supposed to be able to be run programatically?
What I am trying to do is use GroovyStarter to bootstrap a basic Java/Groovy
environment that groovy.ui.GroovyMain (for scripts) or groovy.ui.Console (for
interaction) can be run from. What I am finding is that the classpath given to
GroovyStarter is not propagating to GroovyMain. So I try and move the
"--classpath" arguments from GroovyStarter to GroovyMain and the latter just
ignores them. I'd actually prefer if GroovyStarter properly transferred its
classpath to its "--main" class.