Showing posts with label Ant. Show all posts
Showing posts with label Ant. Show all posts

How to debug Java code originated by ANT script in Eclipse

Need add the followings to the ant target that you are intended to debug.

   
      
      
       ...
    

When you run this target, it will say "[java] Listening for transport dt_socket at address: 5432", and stop here for you to debug.
You need go to Run->Debug Configurations->Remote Java Application
Create a new Debug Configuration

Host: localhost
Port: 5432

Also attach source.

If you run it, it will go to the debugging point.

Ant

Without a good grasp on Ant, I don't think I could master this whole system.
So Ant In Action.

Build File contains ONE project.
Each project contains MULTIPLE targets.
Target contains tasks.
Tasks do the work.

You could invoke any of the tasks individually.


<target name="execute" depends="compile">
<java classname="org.antbook.welcome.Main" classpath="build/classes">
<arg value="a"/>
<arg value="b"/>
<arg file="."/>
</java>
</target>

ant -buildfile build.xml compile <==> ant compile

That's the default thing that I have been talking about, when you use ant without specifying build file name, ant will by default use file name build.xml.

Eclipse has a good integration with Ant, so you could invoke build.xml directly from Eclipse.

ant command-line options:
-help, -h: list the options Ant supports.
-Dproperty=value: set a property to a value. for example: ant -Dhost=localhost. set property host=localhost.
-buildfile , -f: Use the named buildfile.
-keep-going, -k: when one target on the command line fails, still run other targets.
-logfile : save the log to the named file.
-verbose, -v: Print verbose output for better debugging.
-diagnostics: Print information that might be helpful to diagnose or report problems.
-debug, -d: Print debugging information.
-logger : Name a different logger.
-propertyfile : Load properties from file. -D definitions take priorty.
-quiet, -q: Run a quiet build: only print errors.

Just as Java has classes and variables, Ant has datatypes and properties. Ant properties are immutable.

Ant allows flexibility in how Booleans can be specified with on, true, and yes.
${...} denotes a use of Ant property.
PATH, FILESET,