Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create an ant builder file (build.xml) for an existing Java project?

I am working on an Java assignment for a software design course in my university. It's not really complicated and it includes some classes, interfaces and jUnit test cases. We were now told we should supply a build.xml file as an input for an ant builder. I have never heard of, or used ant before. I also saw Eclipse supports it. My questions are - What does build.xml do? How does Eclipse builds my project and why not do the same instead of using ant? And most important - how to create this file with Eclipse?

Thanks.

like image 357
Amir Rachum Avatar asked Apr 26 '10 19:04

Amir Rachum


People also ask

How do I build an Ant build xml?

Create Ant build fileIn the Project tool window, select the directory, where the build file should be created. Right-click the directory and from the context menu, select New | File ( Alt+Insert ). In the New File dialog, specify the name of the new file with the xml extension, for example, build. xml.

Can you write a build xml?

How do I write build. xml file? here is a sample build. xml you just need to know important element e.g. project ,target ,property and task and the order in which different target gets executed to start with basic build procedure.


1 Answers

Ant is a build tool based on Java. It is very powerful, and integrates with various other tools you might need to build any imaginable Java application. It is very useful when deploying a Continunous Integration environment with a Continuous Build server.

You are building within Eclipse, and your build process is bound to your IDE - which is perfectly fine for a one-man project but might prove unefficient for a team project. Also, with Ant, you can have a complex build including multiple components and intricate dependencies done in a single step, including unit tests.

You can either create your Ant build from scratch (which is the best way, but it takes quite a while). Otherwise, you can create it with Eclipse using the File/Export menu (under General, select Ant buildfiles).

like image 145
Etienne Avatar answered Oct 02 '22 10:10

Etienne