Hi Jacques,

Sorry for the late reply - it has been a busy May-day bank holiday weekend
here in the UK.

I think you have already checked this, but yes, you can indeed modify
Groovy script code while OFBiz is running. The script will be re-loaded
(and internally recompiled) by GroovyUtil#getScriptClassFromLocation.

Although at first glance it appears that GroovyUtil has a PARSED_SCRIPTS
cache, so I'm not sure why the updated script is loaded. Perhaps some other
process is running to invalidate the cache on file update.

I have not delved into the details of how IntelliJ maps loaded classes to
source files. I assume there is a mechanism that detects the loading of new
classes and figures out a mapping of class back to source file, meaning
that once a groovy script is loaded, all breakpoints in that script's
source file become live while debugging and will move appropriately
following source code changes.

Dan.

On Sat, 29 Apr 2023 at 13:12, Jacques Le Roux <jacques.le.r...@les7arts.com>
wrote:

> Hi Daniel,
>
> Do you know how are reacting dynamically changed Groovy scripts while you
> are Debugging them, at least in Eclipse (I don't use Intellij).
> The big advantage of minilang was its faculty to allow dynamic changes,
> like Freemarker does. We have the same advantage with Groovy.
> But I wonder for dynamically changed Groovy scripts while you are
> Debugging in Eclipse.
> For instance for Java it's sometimes allowed, but sometimes you need to
> reload all :/
>
> Jacques
>
> Le 28/04/2023 à 12:30, Daniel Watford a écrit :
> > The reason for checking is that groovyScripts are loaded as independent
> > scripts and compiled at runtime by OFBiz (See
> > GroovyUtil#getScriptClassFromLocation), rather than being loaded from a
> > pre-compiled JAR.
>


-- 
Daniel Watford

Reply via email to