|
Hi all,
I have two files: build.xml and doit.groovy as shown below. In Eclipse (Helios 3.6.2) with Groovy-Eclipse plugins (2.6.1.xx.02120118-1300-e36-M1), I have a breakpoint set on the println in the doit.groovy. I do: build.xml > Debug As > Ant Build But, the breakpoint is never hit and execution completes without stopping. Can anyone figure out how to get Eclipse to stop at the breakpoint in the groovy code? By the way, I did read: http://www.vitorrodrigues.com/blog/2009/07/10/debugging-ant-tasks-in-eclipse/ to try to debug scriptdef (groovy) code, but the above doesn't work. Enjoy, Steve Amerige SAS Institute, Deployment Software Development build.xml: <?xml version="1.0" encoding="UTF-8"?> doit.groovy: import org.apache.tools.ant.Task def groovydoit() { Task body = (Task) elements.get("sequential").get(0) println body.dump() // breakpoint set here } |
|
I don't know enough about how Eclipse handles ant debugging, but it
could be that the correct infrastructure is just not set up. You could try invoking ant from a Java launch configuration. Use this class as the main method: org.apache.tools.ant.Main And in the arguments tab, point to your build.xml. I haven't tried this, but you may have better luck since launching this way ensures that the eclipse debug infrastructure is properly set up for the jvm upon launching. On Wed, Jan 25, 2012 at 3:02 PM, Steve Amerige <[hidden email]> wrote: > Hi all, > > I have two files: build.xml and doit.groovy as shown below. In Eclipse > (Helios 3.6.2) with Groovy-Eclipse plugins (2.6.1.xx.02120118-1300-e36-M1), > I have a breakpoint set on the println in the doit.groovy. I do: > > build.xml > Debug As > Ant Build > > But, the breakpoint is never hit and execution completes without stopping. > Can anyone figure out how to get Eclipse to stop at the breakpoint in the > groovy code? > > By the way, I did read: > > > http://www.vitorrodrigues.com/blog/2009/07/10/debugging-ant-tasks-in-eclipse/ > > to try to debug scriptdef (groovy) code, but the above doesn't work. > > Enjoy, > Steve Amerige > SAS Institute, Deployment Software Development > > build.xml: > > <?xml version="1.0" encoding="UTF-8"?> > > <project name="testTemplate" default="main" basedir="."> > <taskdef resource="net/sf/antcontrib/antlib.xml"/> > <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy"/> > > <target name="main"> > <antdoit> > <echo message="inside antdoit"/> > </antdoit> > </target> > > <macrodef name="antdoit"> > <element name="body" implicit="true"/> > <sequential> > <antdoit-internal> > <sequential> > <body/> > </sequential> > </antdoit-internal> > </sequential> > </macrodef> > > <scriptdef name="antdoit-internal" id="doit" language="groovy" > src="doit.groovy"> > <element name="sequential" > classname="org.apache.tools.ant.taskdefs.Sequential"/> > <![CDATA[ > groovydoit() > ]]> > </scriptdef> > > </project> > > > doit.groovy: > import org.apache.tools.ant.Task > > def groovydoit() > { > Task body = (Task) elements.get("sequential").get(0) > println body.dump() // breakpoint set here > } --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
Another possibility is described here:
http://www.vitorrodrigues.com/blog/2009/07/10/debugging-ant-tasks-in-eclipse/ This post describes how you can do remote debugging of the ant process. On Wed, Jan 25, 2012 at 4:03 PM, Andrew Eisenberg <[hidden email]> wrote: > I don't know enough about how Eclipse handles ant debugging, but it > could be that the correct infrastructure is just not set up. > > You could try invoking ant from a Java launch configuration. Use this > class as the main method: org.apache.tools.ant.Main And in the > arguments tab, point to your build.xml. > > I haven't tried this, but you may have better luck since launching > this way ensures that the eclipse debug infrastructure is properly set > up for the jvm upon launching. > > On Wed, Jan 25, 2012 at 3:02 PM, Steve Amerige <[hidden email]> wrote: >> Hi all, >> >> I have two files: build.xml and doit.groovy as shown below. In Eclipse >> (Helios 3.6.2) with Groovy-Eclipse plugins (2.6.1.xx.02120118-1300-e36-M1), >> I have a breakpoint set on the println in the doit.groovy. I do: >> >> build.xml > Debug As > Ant Build >> >> But, the breakpoint is never hit and execution completes without stopping. >> Can anyone figure out how to get Eclipse to stop at the breakpoint in the >> groovy code? >> >> By the way, I did read: >> >> >> http://www.vitorrodrigues.com/blog/2009/07/10/debugging-ant-tasks-in-eclipse/ >> >> to try to debug scriptdef (groovy) code, but the above doesn't work. >> >> Enjoy, >> Steve Amerige >> SAS Institute, Deployment Software Development >> >> build.xml: >> >> <?xml version="1.0" encoding="UTF-8"?> >> >> <project name="testTemplate" default="main" basedir="."> >> <taskdef resource="net/sf/antcontrib/antlib.xml"/> >> <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy"/> >> >> <target name="main"> >> <antdoit> >> <echo message="inside antdoit"/> >> </antdoit> >> </target> >> >> <macrodef name="antdoit"> >> <element name="body" implicit="true"/> >> <sequential> >> <antdoit-internal> >> <sequential> >> <body/> >> </sequential> >> </antdoit-internal> >> </sequential> >> </macrodef> >> >> <scriptdef name="antdoit-internal" id="doit" language="groovy" >> src="doit.groovy"> >> <element name="sequential" >> classname="org.apache.tools.ant.taskdefs.Sequential"/> >> <![CDATA[ >> groovydoit() >> ]]> >> </scriptdef> >> >> </project> >> >> >> doit.groovy: >> import org.apache.tools.ant.Task >> >> def groovydoit() >> { >> Task body = (Task) elements.get("sequential").get(0) >> println body.dump() // breakpoint set here >> } --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
Hi Andrew,
Thanks for your reply. You'll note that I mentioned that link in my original post. :-) Unfortunately, that technique, so far, has not helped. The code does break in the xml code, but it skips right over the scriptdef/groovy code (whether breakpoints are set in CDATA sections or in separate files specified by the src attribute). I also tried invoking Ant from a Java launch configuration. Again, Eclipse never stopped at any breakpoints. It the problem that it just is not possible with Eclipse to debug into scriptdef/groovy code? Is it possible that some other IDE can pass this breakpoint test? Thanks again, Steve Amerige SAS Institute, Deployment Software Development On 1/26/2012 12:08 AM, Andrew Eisenberg wrote: Another possibility is described here: http://www.vitorrodrigues.com/blog/2009/07/10/debugging-ant-tasks-in-eclipse/ This post describes how you can do remote debugging of the ant process. On Wed, Jan 25, 2012 at 4:03 PM, Andrew Eisenberg [hidden email] wrote:I don't know enough about how Eclipse handles ant debugging, but it could be that the correct infrastructure is just not set up. You could try invoking ant from a Java launch configuration. Use this class as the main method: org.apache.tools.ant.Main And in the arguments tab, point to your build.xml. I haven't tried this, but you may have better luck since launching this way ensures that the eclipse debug infrastructure is properly set up for the jvm upon launching. On Wed, Jan 25, 2012 at 3:02 PM, Steve Amerige [hidden email] wrote:Hi all, I have two files: build.xml and doit.groovy as shown below. In Eclipse (Helios 3.6.2) with Groovy-Eclipse plugins (2.6.1.xx.02120118-1300-e36-M1), I have a breakpoint set on the println in the doit.groovy. I do: build.xml > Debug As > Ant Build But, the breakpoint is never hit and execution completes without stopping. Can anyone figure out how to get Eclipse to stop at the breakpoint in the groovy code? By the way, I did read: http://www.vitorrodrigues.com/blog/2009/07/10/debugging-ant-tasks-in-eclipse/ to try to debug scriptdef (groovy) code, but the above doesn't work. Enjoy, Steve Amerige SAS Institute, Deployment Software Development build.xml: <?xml version="1.0" encoding="UTF-8"?> <project name="testTemplate" default="main" basedir="."> <taskdef resource="net/sf/antcontrib/antlib.xml"/> <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy"/> <target name="main"> <antdoit> <echo message="inside antdoit"/> </antdoit> </target> <macrodef name="antdoit"> <element name="body" implicit="true"/> <sequential> <antdoit-internal> <sequential> <body/> </sequential> </antdoit-internal> </sequential> </macrodef> <scriptdef name="antdoit-internal" id="doit" language="groovy" src="doit.groovy"> <element name="sequential" classname="org.apache.tools.ant.taskdefs.Sequential"/> <![CDATA[ groovydoit() ]]> </scriptdef> </project> doit.groovy: import org.apache.tools.ant.Task def groovydoit() { Task body = (Task) elements.get("sequential").get(0) println body.dump() // breakpoint set here } |
|
> Thanks for your reply. You'll note that I mentioned that link in my
> original post. :-) Right. I don't know what I was thinking. :) I tried this out and I see what the problem is. Groovy loads the script using an internal name of "scriptdef_antdoit_internal", which is the name that you provided ("antdoit_internal") with "scriptdef_" prepended to it. If we could change the name to "doit.groovy", then debugging would work (I tried this and the breakpoint was hit). So, there are 2 things that need to change to get this working: 1. in your ant file, rename your script to "doit.groovy". Easy 2. in the GroovyEngine class, there needs to be a change to the logic of how script names are generated. Currently, the logic is to just convert all illegal characters to '_', but additionally, if there is a "scriptdef_" prefix, then it needs to be removed. I'll raise a jira for this on groovy. > Unfortunately, that technique, so far, has not helped. The code does break > in the xml code, but it skips right over the scriptdef/groovy code (whether > breakpoints are set in CDATA sections or in separate files specified by the > src attribute). > > I also tried invoking Ant from a Java launch configuration. Again, Eclipse > never stopped at any breakpoints. > > It the problem that it just is not possible with Eclipse to debug into > scriptdef/groovy code? Is it possible that some other IDE can pass this > breakpoint test? > > Thanks again, > > Steve Amerige > SAS Institute, Deployment Software Development > > On 1/26/2012 12:08 AM, Andrew Eisenberg wrote: > > Another possibility is described here: > http://www.vitorrodrigues.com/blog/2009/07/10/debugging-ant-tasks-in-eclipse/ > > This post describes how you can do remote debugging of the ant process. > > On Wed, Jan 25, 2012 at 4:03 PM, Andrew Eisenberg <[hidden email]> > wrote: > > I don't know enough about how Eclipse handles ant debugging, but it > could be that the correct infrastructure is just not set up. > > You could try invoking ant from a Java launch configuration. Use this > class as the main method: org.apache.tools.ant.Main And in the > arguments tab, point to your build.xml. > > I haven't tried this, but you may have better luck since launching > this way ensures that the eclipse debug infrastructure is properly set > up for the jvm upon launching. > > On Wed, Jan 25, 2012 at 3:02 PM, Steve Amerige <[hidden email]> > wrote: > > Hi all, > > I have two files: build.xml and doit.groovy as shown below. In Eclipse > (Helios 3.6.2) with Groovy-Eclipse plugins (2.6.1.xx.02120118-1300-e36-M1), > I have a breakpoint set on the println in the doit.groovy. I do: > > build.xml > Debug As > Ant Build > > But, the breakpoint is never hit and execution completes without stopping. > Can anyone figure out how to get Eclipse to stop at the breakpoint in the > groovy code? > > By the way, I did read: > > > http://www.vitorrodrigues.com/blog/2009/07/10/debugging-ant-tasks-in-eclipse/ > > to try to debug scriptdef (groovy) code, but the above doesn't work. > > Enjoy, > Steve Amerige > SAS Institute, Deployment Software Development > > build.xml: > > <?xml version="1.0" encoding="UTF-8"?> > > <project name="testTemplate" default="main" basedir="."> > <taskdef resource="net/sf/antcontrib/antlib.xml"/> > <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy"/> > > <target name="main"> > <antdoit> > <echo message="inside antdoit"/> > </antdoit> > </target> > > <macrodef name="antdoit"> > <element name="body" implicit="true"/> > <sequential> > <antdoit-internal> > <sequential> > <body/> > </sequential> > </antdoit-internal> > </sequential> > </macrodef> > > <scriptdef name="antdoit-internal" id="doit" language="groovy" > src="doit.groovy"> > <element name="sequential" > classname="org.apache.tools.ant.taskdefs.Sequential"/> > <![CDATA[ > groovydoit() > ]]> > </scriptdef> > > </project> > > > doit.groovy: > import org.apache.tools.ant.Task > > def groovydoit() > { > Task body = (Task) elements.get("sequential").get(0) > println body.dump() // breakpoint set here > } > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
Raised: https://jira.codehaus.org/browse/GROOVY-5266
Groovy 1.8.6 may be released soon, so make some noise on this bug if you want it fixed for that release. On Thu, Jan 26, 2012 at 11:05 AM, Andrew Eisenberg <[hidden email]> wrote: >> Thanks for your reply. You'll note that I mentioned that link in my >> original post. :-) > > Right. I don't know what I was thinking. :) > > I tried this out and I see what the problem is. Groovy loads the > script using an internal name of "scriptdef_antdoit_internal", which > is the name that you provided ("antdoit_internal") with "scriptdef_" > prepended to it. If we could change the name to "doit.groovy", then > debugging would work (I tried this and the breakpoint was hit). > > So, there are 2 things that need to change to get this working: > > 1. in your ant file, rename your script to "doit.groovy". Easy > 2. in the GroovyEngine class, there needs to be a change to the logic > of how script names are generated. Currently, the logic is to just > convert all illegal characters to '_', but additionally, if there is a > "scriptdef_" prefix, then it needs to be removed. I'll raise a jira > for this on groovy. > >> Unfortunately, that technique, so far, has not helped. The code does break >> in the xml code, but it skips right over the scriptdef/groovy code (whether >> breakpoints are set in CDATA sections or in separate files specified by the >> src attribute). >> >> I also tried invoking Ant from a Java launch configuration. Again, Eclipse >> never stopped at any breakpoints. >> >> It the problem that it just is not possible with Eclipse to debug into >> scriptdef/groovy code? Is it possible that some other IDE can pass this >> breakpoint test? >> >> Thanks again, >> >> Steve Amerige >> SAS Institute, Deployment Software Development >> >> On 1/26/2012 12:08 AM, Andrew Eisenberg wrote: >> >> Another possibility is described here: >> http://www.vitorrodrigues.com/blog/2009/07/10/debugging-ant-tasks-in-eclipse/ >> >> This post describes how you can do remote debugging of the ant process. >> >> On Wed, Jan 25, 2012 at 4:03 PM, Andrew Eisenberg <[hidden email]> >> wrote: >> >> I don't know enough about how Eclipse handles ant debugging, but it >> could be that the correct infrastructure is just not set up. >> >> You could try invoking ant from a Java launch configuration. Use this >> class as the main method: org.apache.tools.ant.Main And in the >> arguments tab, point to your build.xml. >> >> I haven't tried this, but you may have better luck since launching >> this way ensures that the eclipse debug infrastructure is properly set >> up for the jvm upon launching. >> >> On Wed, Jan 25, 2012 at 3:02 PM, Steve Amerige <[hidden email]> >> wrote: >> >> Hi all, >> >> I have two files: build.xml and doit.groovy as shown below. In Eclipse >> (Helios 3.6.2) with Groovy-Eclipse plugins (2.6.1.xx.02120118-1300-e36-M1), >> I have a breakpoint set on the println in the doit.groovy. I do: >> >> build.xml > Debug As > Ant Build >> >> But, the breakpoint is never hit and execution completes without stopping. >> Can anyone figure out how to get Eclipse to stop at the breakpoint in the >> groovy code? >> >> By the way, I did read: >> >> >> http://www.vitorrodrigues.com/blog/2009/07/10/debugging-ant-tasks-in-eclipse/ >> >> to try to debug scriptdef (groovy) code, but the above doesn't work. >> >> Enjoy, >> Steve Amerige >> SAS Institute, Deployment Software Development >> >> build.xml: >> >> <?xml version="1.0" encoding="UTF-8"?> >> >> <project name="testTemplate" default="main" basedir="."> >> <taskdef resource="net/sf/antcontrib/antlib.xml"/> >> <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy"/> >> >> <target name="main"> >> <antdoit> >> <echo message="inside antdoit"/> >> </antdoit> >> </target> >> >> <macrodef name="antdoit"> >> <element name="body" implicit="true"/> >> <sequential> >> <antdoit-internal> >> <sequential> >> <body/> >> </sequential> >> </antdoit-internal> >> </sequential> >> </macrodef> >> >> <scriptdef name="antdoit-internal" id="doit" language="groovy" >> src="doit.groovy"> >> <element name="sequential" >> classname="org.apache.tools.ant.taskdefs.Sequential"/> >> <![CDATA[ >> groovydoit() >> ]]> >> </scriptdef> >> >> </project> >> >> >> doit.groovy: >> import org.apache.tools.ant.Task >> >> def groovydoit() >> { >> Task body = (Task) elements.get("sequential").get(0) >> println body.dump() // breakpoint set here >> } >> >> --------------------------------------------------------------------- >> To unsubscribe from this list, please visit: >> >> http://xircles.codehaus.org/manage_email >> >> >> >> >> --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
Hi Andrew,
Many thanks for the analysis. I'll add a comment to the ticket. If you can think of a workaround, please let me know. Unfortunately, my code is called by a third party, so I have no ability to compile code or do anything but write Ant and/or scriptdef Groovy or Javascript code. Again, thanks for the keen analysis! Regards, Steve Amerige SAS Institute, Deployment Software Development On 1/26/2012 2:12 PM, Andrew Eisenberg wrote: Raised: https://jira.codehaus.org/browse/GROOVY-5266 Groovy 1.8.6 may be released soon, so make some noise on this bug if you want it fixed for that release. On Thu, Jan 26, 2012 at 11:05 AM, Andrew Eisenberg [hidden email] wrote:Thanks for your reply. You'll note that I mentioned that link in my original post. :-) |
| Powered by Nabble | Edit this page |
