Shailesh Tainwala
Shailesh Tainwala

Reputation: 6507

Using Apache Ant APIs in Java program to programmatically build source files

I am looking for good and practical resources that will help me use the Ant APIs effectively. The project website just gives the documentation of the API which is not useful at all. Very few websites seem to give very brief tutorials on the subject.

Is there some resource I am missing out on? How can I use the Ant APIs for simple tasks, without spending hours browsing through them and looking at source code?

Thanks.

(Answers to previously asked questions not helpful - How can i use Apache ANT Programmatically )

Upvotes: 6

Views: 2730

Answers (3)

Shailesh Tainwala
Shailesh Tainwala

Reputation: 6507

As it turns out, the lack of good resources on using the Ant API, is known and intended. The bottom paragraph of this article from the Ant says -

The question you are probably asking yourself at this point is: How would I know which classes and methods have to be called in order to set up a dummy Project and Target? The answer is: you don't. Ultimately, you have to be willing to get your feet wet and read the source code. The above example is merely designed to whet your appetite and get you started. Go for it!

So this seems to be the only way to make best use of the API.

Upvotes: 4

Vicky
Vicky

Reputation: 121

There is no better manual to understand ANT than : http://ant.apache.org/manual/index.html

I am not sure if you've gone through this link that explains in detail about creating a task. A word of caution, If you're new to ANT, there is no easy way to jump on this tutorial. Better to learn the basics before you come here. Refer above link for a good starting point.

Upvotes: 0

Andrew Thompson
Andrew Thompson

Reputation: 168815

..Java program to programmatically build source files

If compiling/Jarring is all you need and you can run it in an SDK (as opposed to a plain JRE), look to the JavaCompiler class for compilation. Then use the Jar related classes to build the Jars.

All J2SE. Ant not included, Ant not required.

Upvotes: 2

Related Questions