Reputation: 6980
I am working on some Java projects and using ant
to build my projects. The environment and the project structure is such that I cannot use any IDE.
Hence, I am looking for a good tool that can generate build.xml
files to be used with ant (if possible something similar to autotools
for c++).
Upvotes: 2
Views: 4116
Reputation: 77951
No such thing as a "standard" ANT file. This makes it difficult to develop a generic ANT file generator. Course there's nothing stopping you from writing one yourself (simplified example below)
Don't forget that ANT is very cross-platform, unlike make. This might explain the lack of tools equivalent to autotools.
This example uses a simple template file called build.xml.template:
<project name="%PROJECT_NAME%" default="helloworld">
<target name="helloworld" description="Pretty pointless ANT target">
<echo message="%MESSAGE%"/>
</target>
</project>
The UNIX sed command can then be used to substitute values and generate the ANT file:
$ sed -e 's/%PROJECT_NAME%/hello world/' -e 's/%MESSAGE%/hello world/' build.xml.template
This is a really simple generator. I'd suggest investigate a proper template engine for a more powerful solution.
As suggested in other answers, Maven can be used to generate new projects:
$ mvn archetype:generate
Still end up with a rather complex XML based file that might need further tweaking.
If you're looking for a Java build tool with a simple build specification, nothing beats Gradle.
build.gradle:
apply plugin: 'java'
All you need is to compile a Java project with no external dependencies.
Upvotes: 3
Reputation: 2187
I work a lot in ANT but I always write build.xml manually in edit plus.
Upvotes: 0