Easy to Learn Java: Programming Articles, Examples and Tips

Start with Java in a few days with Java Lessons or Lectures


Code Examples

Java Tools

More Java Tools!

Java Forum

All Java Tips


Submit News
Search the site here...
Search the JavaFAQ.nu
1000 Java Tips ebook

1000 Java Tips - Click here for the high resolution copy!1000 Java Tips - Click here for the high resolution copy!

Java Screensaver, take it here

Free "1000 Java Tips" eBook is here! It is huge collection of big and small Java programming articles and tips. Please take your copy here.

Take your copy of free "Java Technology Screensaver"!.

Maven vs Ant or Ant vs Maven?

JavaFAQ Home » Java Tools Go to all tips in Java Tools

Bookmark and Share

Maven vs Ant.

This article is not about religious war between two groups of developers, it is about what is real difference between two tools and why in one case you choose Ant and in another Maven. It help you if you f you in a hurry to make a choice between two Java build tools. Very easy to understand overview over Maven and Ant build concept.

We usually prefer one tool over another because we want make developers happy and:

  • Develop faster
  • Concentrate on real work
  • Generate all related document easy

We also prefer one tool over another to keep our bosses happy, which means:

  • Reduce development costs
  • Reduce time to market
  • Frequent status reports, which can be easily presented to higher boss Smile

Historically Ant is much older tool and it was deigned to have some Java-based build tool. Something similar to Make which most of C++ developers use. Those who worked with Make probably know that is extremely powerful tool which can do whatever developer wants.

Ant is different. Instead of a model where it is extended with shell-based commands, Ant is extended using Java classes. Instead of writing shell commands, the configuration files are XML-based, The power of Ant in practice results that you have to setup build process yourself. Each project can have different build process. New team members have to study this version of build which is probably they used to have in another project.

Maven (Maven)on another hand wants a standard way to build the projects, a clear definition of what the project consisted of, an easy way to publish project information and a way to share JARs across several projects.

Maven does encourage best practices and some people can prefer Ant. Maven is less flexible than Ant and you have to be agree with making of some compromises.

Maven is not the next generation Ant!

Ant and Maven are different. Maven is not just a building tool, it provide an organization and a structure layer. All you do in ant can be done in Maven because you can call ant target.

The main advantage to migrate to Maven are : standardization of how to handle a project, dependencies are clearly defined, the concept of artifacts that can be shared to other projects, documentation and reports, remote and local repository concepts.

Maven will help you with:

  • Making the build process easy and provide uniform build environment
  • Generate quality project information

Comparison table for major advantages/disadvantages - Maven vs Ant.

Maven Ant
Description of project Development of a build script per project
Invocation of defined goals (targets) Invocation of project specific targets
Project knowledge "Just" the build process
build lifecycle, standard project layout too complex scripts
reusable plugins, repositories scripts are not reusable
moving fast forward development are slowed down

The good thing with Maven that it is extremely flexible, because it consists of core and numerous plugins that are accessible in online repositories. Relations between different projects and subprojects are based on a single source of information POM (xml) file - Project object Model. One POM points to another POMs which can have flat or hierarchical structure.

A project produces an artifact - jar, ear, war... The next features are good with Maven:

  • Dependencies are downloaded automatically
  • Standardized, very consistent layout
  • Standardized, very consistent naming
  • Code coverage
  • Extensive reports
  • Maven easily works with JUnit tests

 Printer Friendly Page  Printer Friendly Page
 Send to a Friend  Send to a Friend

.. Bookmark and Share

Search here again if you need more info!
Custom Search

Home Code Examples Java Forum All Java Tips Books Submit News, Code... Search... Offshore Software Tech Doodling

RSS feed Java FAQ RSS feed Java FAQ News     

    RSS feed Java Forums RSS feed Java Forums

All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest 1999-2006 by Java FAQs Daily Tips.

Interactive software released under GNU GPL, Code Credits, Privacy Policy