You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Steve Amerige <St...@sas.com> on 2012/01/25 23:49:45 UTC

Eclipse Debugging: Ant and Groovy

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
    }


Re: Eclipse Debugging: Ant and Groovy

Posted by Nicolas Lalevée <ni...@hibnet.org>.
The Ant Eclipse plugin and the Groovy Eclipse plugin doesn't know each other, I don't think there's way to make it work properly.
Maybe on the groovy eclipse plugin user mailing list [1] some may have some better ideas.

Nicolas

[1] http://xircles.codehaus.org/lists/eclipse-plugin-user@groovy.codehaus.org

Le 25 janv. 2012 à 23:49, Steve Amerige a écrit :

> 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, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org