Dear all, I'm a novice coming to java. I want to know why instead of following the simple compiling process in real-time projects they are using build tools like ant or maven, which doesn't make any sense to novice like me(atleast their terrorising xml files) Regards.
Note: Atleast I understand it gives some benefits over simple-compile , that's why they are using it in all real-projects, but don't know how they are benefitable.
Your doubt is because you think build is just another way to compile. Its much more (but also includes compiling). One scenario - you can configure builds to run at a specific time(usually done at night and called 'nightly builds'). Yes, you can do this by putting a person incharge to compile and package your code every night at 12 but build seems to be easier. And also running Unit tests(also generate pretty reports)! You can run your tests from ant/maven. Typically programmers are lazy. They want to get the jar/war with minimum effort. So they dont want to 'right click' and compile then right click and jar or run tests. Write a build(with some effort upfront) and just type 'ant' everytime. (I m tired of typing this much text - i m a good programmer ) [ November 12, 2008: Message edited by: rakesh sugirtharaj ]
You'll find that Ant and Maven are pretty much default industry build tools. Although their XML configuration files can get pretty complex, you'll be surprised at how quickly you can set up a simple build, test, deploy cycle in either of those to technologies. I recommend you visit their web sites and go through the starting tutorials.
The benefits of using these tools are enormous, you're able to environmentalise builds, test builds, deploy builds and a host of other things (such as running reports on code quality).
I agree that looking at existing build scripts, especially complicated ones such as those generated by NetBeans, can terrorize you. It is probably better to ignore such scripts and start out simply. For that you will need either a tutorial or a book. Ant in Action is a good book for Ant (I have the prior version and found it indispensable). For Maven there is Better Builds with Maven, a free PDF you can download. In addition, the Maven project has a web page listing various resources.
Originally posted by Peter Johnson: For Maven there is Better Builds with Maven, a free PDF you can download.[/URL]
Great links Peter, this PDF in particular is fantastic and the cornerstone document of how we moved to Maven on our current project. In particular it covers why Maven isn't just a build tool, it's a way of structuring your development as well.