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. Thanks, Robert Wynkoop |
Debugger might not work given that these scripts are not directly called
within the classpath (they are enhanced with OFBiz-specific context information. I would use print statements to debug things. On Fri, Jan 10, 2020 at 6:55 PM Robert Wynkoop <[hidden email]> 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 > |
In reply to this post by Robert Wynkoop
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: 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 <[hidden email]> wrote:
Daniel Watford
|
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 <[hidden email]> 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 <[hidden email]> > 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 > |
Administrator
|
In reply to this post by Robert Wynkoop
You might be interested by https://issues.apache.org/jira/browse/OFBIZ-10226
HTH Jacques Le 10/01/2020 à 16:46, Robert Wynkoop a écrit : > 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. > > 2020-01-10 09_40_18-ofbiz-framework - Apache NetBeans IDE 11.2.jpg > > Thanks, > > Robert Wynkoop |
Jacques,
Thanks. Well I'm having fun. New to Gradle, new to Goovy, I'm not making progress. I added getDirectoryInActiveComponentsIfExists('groovyScripts') to sourceSets { main { groovy { But no joy in Netbeans. I then ran the task "eclipse" and tried eclipse(with build), with no success also. Any ideas of what I might try? On Fri, Jan 10, 2020 at 11:26 AM Jacques Le Roux < [hidden email]> wrote: > You might be interested by > https://issues.apache.org/jira/browse/OFBIZ-10226 > > HTH > > Jacques > > Le 10/01/2020 à 16:46, Robert Wynkoop a écrit : > > 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. > > > > 2020-01-10 09_40_18-ofbiz-framework - Apache NetBeans IDE 11.2.jpg > > > > Thanks, > > > > Robert Wynkoop > > |
Administrator
|
Le 10/01/2020 à 22:38, Robert Wynkoop a écrit :
> Any ideas of what I might try? Using Eclipse or IntelliJ ? Sorry ;) Jacques |
Jacques,
If I can get it working in Eclipse, then I will be able to figure Netbeans out. Using Eclipse: Version: 2019-09 R (4.13.0) Build id: 20190917-1200 Installed Plugin that may be relevant: Groovy Development Tools 3.7.0 Buildship Gradle Integration 3.0 EGradle Editor and IDE 2.6.1 Thanks for your time. Robert Wynkoop On Fri, Jan 10, 2020 at 4:06 PM Jacques Le Roux < [hidden email]> wrote: > Le 10/01/2020 à 22:38, Robert Wynkoop a écrit : > > Any ideas of what I might try? > > Using Eclipse or IntelliJ ? > > Sorry ;) > > Jacques > > |
In reply to this post by Robert Wynkoop
Hi Robert,
Debugging groovy scripts should work in IntelliJ IDEA Community Edition. Also see https://cwiki.apache.org/confluence/display/OFBIZ/Running+and+Debugging+OFBiz+in+Intellij+IDEA Regards, James On 2020/01/10 15:46:20, Robert Wynkoop <[hidden email]> 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 > |
Administrator
|
In reply to this post by Robert Wynkoop
Robert,
For that we need to complete https://issues.apache.org/jira/browse/OFBIZ-11205 (forgot about it while working on more pressing stuff like CSRF) Jacques Le 10/01/2020 à 23:21, Robert Wynkoop a écrit : > Jacques, > > If I can get it working in Eclipse, then I will be able to figure Netbeans > out. > > Using Eclipse: > Version: 2019-09 R (4.13.0) > Build id: 20190917-1200 > > Installed Plugin that may be relevant: > Groovy Development Tools 3.7.0 > Buildship Gradle Integration 3.0 > EGradle Editor and IDE 2.6.1 > > Thanks for your time. > > Robert Wynkoop > > On Fri, Jan 10, 2020 at 4:06 PM Jacques Le Roux < > [hidden email]> wrote: > >> Le 10/01/2020 à 22:38, Robert Wynkoop a écrit : >>> Any ideas of what I might try? >> Using Eclipse or IntelliJ ? >> >> Sorry ;) >> >> Jacques >> >> |
In reply to this post by James Yong-2
James,
Wow. It has been since 2010, since I used InteliliJ. It freaking just works. I love the key mapping(Double shift, Double cntl) to search and run anything. In Eclipse I had been trying ofbizDebug task, vs in here I used ofbiz from the debug menu. Thanks. On Fri, Jan 10, 2020 at 6:42 PM James Yong <[hidden email]> wrote: > Hi Robert, > > Debugging groovy scripts should work in IntelliJ IDEA Community Edition. > > Also see > https://cwiki.apache.org/confluence/display/OFBIZ/Running+and+Debugging+OFBiz+in+Intellij+IDEA > > Regards, > James > > On 2020/01/10 15:46:20, Robert Wynkoop <[hidden email]> 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 > > > |
Hi Robert,
Welcome. Glad to know you are doing good with the debugging. Best Regards, James On 2020/01/12 02:51:43, Robert Wynkoop <[hidden email]> wrote: > James, > > Wow. It has been since 2010, since I used InteliliJ. > > It freaking just works. I love the key mapping(Double shift, Double cntl) > to search and run anything. > > In Eclipse I had been trying ofbizDebug task, vs in here I used ofbiz from > the debug menu. > > Thanks. > > > On Fri, Jan 10, 2020 at 6:42 PM James Yong <[hidden email]> wrote: > > > Hi Robert, > > > > Debugging groovy scripts should work in IntelliJ IDEA Community Edition. > > > > Also see > > https://cwiki.apache.org/confluence/display/OFBIZ/Running+and+Debugging+OFBiz+in+Intellij+IDEA > > > > Regards, > > James > > > > On 2020/01/10 15:46:20, Robert Wynkoop <[hidden email]> 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 > > > > > > |
Free forum by Nabble | Edit this page |