tags:

views:

84

answers:

3

Is it possible to create ant build file from java code using ant API? Thank you for your help.

+3  A: 

No ANT api doesn't provide such feature. You'll have to use one of the following solution to "manually" write your build.xml file:

  1. Serialization to file output stream
  2. DOM + Xerces serialization to file output stream
  3. SAX + Xerces serialization to file output stream
Manuel Selva
+3  A: 

If you do not need to stick to Java, the easiest way is to use groovy and groovy ant buillder (see here). Groovy is compiled into Java VM code and can be easily integrated into a Java program.

Skarab
A: 

This post may be able to help you.

In this post author is trying to run Java application from another application using ANT API.

Java Applications From Java applications with Ant

Jaydeep