Ant build process - when does compilation actually happen
Chris Cassano
Greenhorn
Joined: Jun 20, 2012
Posts: 2
posted
0
Hi, I've got a project that I'm trying to deploy and I'm having some issues. My question is when does compilation happen in the build.xml file? My ant build is finishing successfully but there are no files in my projecthome/bin folder. I know that when the build process finishes, there should be class files in the bin folder. What directive in the build.xml file tells ant to compile? How can I make ant create the .class files? I don't think that I have to call <javac> explicitly, right? Ant should generate the class files on it's own, or am I wrong?
If I'm misunderstanding something then please explain how it works. I'm new to Ant and I'm trying to build someone else's project.
Ant build files are basically "programs" and they build things under specified orders. If you don't specify a task, it doesn't get done. An empty build.xml does nothing at all.
Maven POMs are information repositories. Maven builds everything by "magic", using the POM as a reference and inferring lots of things if they aren't explicitly defined in the POM.
Since I'm not a big fan of "magic", I resisted using Maven for a long time, but these days I use it more than I do Ant.
Customer surveys are for companies who didn't pay proper attention to begin with.
Ant is a scripting language, much akin to the make tool for C/C++ development. Only the operations defined in the script will be performed. Gives you lots of power: you can do pretty much anything you want, and that is not restricted to just building Java apps. But you do have to tell it exactly what you want done.
If you want things to be done automatically based on best practices, then use Maven. It will compile your sources, run your unit tests, package up the JAR file, and even generate a number of reports, without you having to do anything other than give it some basic information about your project (mainly what you want to name it).
Technically, it's not scripting, which is why I said "programs" in quotes. Ant build.xml files (and Unix makefiles) are declarative files, not executables (scripts). But pedantry aside, the net effect is the same. Ant will only perform tasks which have been explicitly requested.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: Ant build process - when does compilation actually happen