Java Mailing List Archive

http://www.ant-tasks.com/

Home » Ant Users List »

Eclipse Debugging: Ant and Groovy

Steve Amerige

2012-01-25

Replies: Find Java Web Hosting

Author LoginPost Reply
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
  }

©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.