Showing posts with label ant. Show all posts
Showing posts with label ant. Show all posts

Thursday, July 15, 2010

Debugging throug Ant

To add debug options to java command line:
 

-Xdebug -Xrunjdwp:transport=dt_socket,server=y,
suspend=n,address=9009



If  the java process runs and terminates itself, change suspend=y, so you  can have a chance to attach the remote debugger.

To add the same debug options to ant build.xml java task:
<target name="run">
 <java fork="on"
       failonerror="true"
       classpath="xxx"
       classname="xxx">
     <jvmarg line="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,
suspend=y,address=9009" />
     <arg line="--arg1 arg2 --arg3 arg4"/>
  </java>
</target>

<arg> and <jvmarg> take either line or value attribute, but value attributes are treated as one single argument that may contain spaces. So in our case line attribute is used to specify multiple arguments separated by spaces. If value attribute was used instead of line attribute, the debug options will not take effect.

Saturday, October 10, 2009

Ant build javac compiler error

Last week I was using Ant 1.7.1 to compile the alfresco source code. I was using the JDK1.6.0.14.
The build file was giving the error
Error running .../javac.exe compiler

I rechecked the JAVA_HOME and ANT_HOME were set to correct location.

I checked the build file for error line. It was


destdir="@{projectdir}/${dir.name.build}/${dir.name.classes}"
fork="true"
memoryMaximumSize="${mem.size.max}"
debug="${javac.debug}"
target="${javac.target}"
source="${javac.source}"
encoding="${javac.encoding}"
excludes="@{compileExcludes}"
>

What I did was removed the attribute

fork="true"
memoryMaximumSize="${mem.size.max}"

And the build was successful this time.