6

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.

Amir Rachum
  • 76,817
  • 74
  • 166
  • 248
  • Would http://stackoverflow.com/questions/206473/build-eclipse-java-project-from-command-line/206587#206587 help? – VonC Apr 26 '10 at 20:26

2 Answers2

6

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).

Etienne
  • 901
  • 6
  • 15
2

You should definitely know how to crate a build.xml file from scratch, just so you know what Eclipse does behind the scenes.

I taught a Java class a while ago where I explained the basics of ant.

aduric
  • 2,812
  • 3
  • 22
  • 16