File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes A layman's doubt on build Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "A layman Watch "A layman New topic
Author

A layman's doubt on build

ramya narayanan
Ranch Hand

Joined: Oct 06, 2008
Posts: 338
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.
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3827

You will find this Ranch artical explains specifically about ant build tool, And Ranch FAQ for Build Tools very much helpfull.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
ramya narayanan
Ranch Hand

Joined: Oct 06, 2008
Posts: 338
It's highly technical with so many complex jargons.
Can anybody brief about why we use build tools instead of simple compile?
Regards.
rakesh sugirtharaj
Ranch Hand

Joined: Dec 16, 2007
Posts: 151
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 ]

Cheers!
RSR
ramya narayanan
Ranch Hand

Joined: Oct 06, 2008
Posts: 338
<macrodef name="setclasspath">
<attribute default=""
name="prepend.classpath"/>
<attribute default="" name="append.classpath"/>
<sequential>
<path id="build.classpath">
<pathelement path="@{prepend.classpath}"/>
<path refid="default.classpath"/>
<pathelement
path="@{append.classpath}"/>
</path>
<pathconvert dirsep="/" property="build.classpath.property" refid="build.classpath"/>
</sequential>
</macrodef>

When you see code like this, you will certainly get terror?
Right.
Regards.
rakesh sugirtharaj
Ranch Hand

Joined: Dec 16, 2007
Posts: 151
Yes. Terrorizing enough for a programmer. But many projects have 'Build Managers' whose job is to deal with this sort of terror.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Not all build tools use that kind of syntax. Gradle for example uses Groovy scripts for builds. There are many others like Gant and Builr.

I'm going to move this to the Ant, Maven, and Other Build Tools forum where build tools are generally discussed.
[ November 12, 2008: Message edited by: Gregg Bolinger ]

GenRocket - Experts at Building Test Data
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Hi ramya,

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

It really will improve your development life!


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5823
    
    7

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.


JBoss In Action
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A layman's doubt on build