ofbiz-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Wynkoop <robert.wynk...@gmail.com>
Subject Re: How to debug Groovy scripts.
Date Fri, 10 Jan 2020 17:18:46 GMT
Dan,

Thanks.

In netbeans I can get the debugger to attach, but get a msg can not set
break point.
I get this message in the debugger console.  I can set other java
breakpoints.
Invalid LineBreakpoint InitTheme.groovy : 31
LineBreakpoint UtilMisc.java : 68 successfully submitted.

Robert Wynkoop

On Fri, Jan 10, 2020 at 11:00 AM Daniel Watford <dan@foomoo.co.uk> wrote:

> Hi Robert,
>
> <sidebar>
> Groovy scripts are not on the classpath in the normal sense, but are
> loaded (and I guess compiled) at runtime from the script's .groovy file.
>
> This is handled in the GroovyEngine#serviceInvoker where you'll see a line
> similar to:
>
> Script script = InvokerHelper.createScript(GroovyUtil.getScriptClassFromLocation(this.getLocation(modelService)),
GroovyUtil.getBinding(gContext));
>
> By following the above call to GroovyUtil.getScriptClassFromLocation, it
> looks like the script is read from the .groovy file each time the groovy
> service is invoked, and added to the relevant at this point.
>
> </sidebar>
>
> Since the script does get on the classpath, it should be accessible from
> your debugger.
>
> I use IntelliJ to debug groovy services/events.
>
> Launch Ofbis using:
> ./gradlew ofbizDebug
>
> Once the initial build steps are complete you should see:
> [image: image.png]
>
>
>
> Set your debugger to connect to a remote VM on localhost port 5005. Ofbiz
> won't continue to load until your debugger is connected.
>
> Once connected, if you aren't able to hit any breakpoints then it is worth
> checking how your debugger associates sources with the remote VM's
> classpath.
>
> Hopefully that should get you connected. We can then figure out any other
> IDE specific issues after that.
>
> Note: you can only modify a script called as a service or event. You can't
> modify any supporting classes (groovy or java) without a rebuild and
> restarting ofbiz. This is due to those supporting classes being loaded from
> the proper classpath, and I haven't been able to get ofbiz to recognise
> that those compile classfiles on the classpath have been modified and to
> reload them accordingly. Finding a solution to this will massively improve
> development for me.
>
> Cheers,
>
> Dan.
>
>
> On Fri, 10 Jan 2020 at 15:55, Robert Wynkoop <robert.wynkoop@gmail.com>
> wrote:
>
>> How do I debug the Groovy scripts?
>>
>> In netbeans and eclipse, the groovy file does not seem to be on the class
>> path.
>>
>> I'm unable to set break points.  Any tips to configure so I can debug
>> OFBiz Java embedded Groovy.
>>
>> [image: 2020-01-10 09_40_18-ofbiz-framework - Apache NetBeans IDE
>> 11.2.jpg]
>>
>> Thanks,
>>
>> Robert Wynkoop
>>
>
>
> --
> Daniel Watford
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message