Solved

J2ee-  Difference between Ant and Maven

Posted on 2014-03-10
1
596 Views
Last Modified: 2014-03-15
Hi All,
Can someone please list with an example difference between Ant and Maven?

Does they play any role with kind of progamming used to build java app like struts, hibernate, spring?

Thanks
0
Comment
Question by:crazywolf2010
1 Comment
 
LVL 35

Accepted Solution

by:
mccarl earned 500 total points
ID: 39919139
Can someone please list with an example difference between Ant and Maven?
They are basically the same, in that they help to automate the building of applications, including the compiling, testing and packaging of the application (and others).

The main difference is that Maven has built-in support for managing the resolution of dependencies, ie. you just indicate to Maven that you code depends on the Spring libraries, and it can automatically download those dependencies and include them in your application, etc.

The other difference that I will highlight is that (at least in my way of thinking) Ant is much more like a scripted build, where you define each step in the build process and Ant will execute them. Whereas Maven has that, but the build process flow is more built in to Maven and you just "hook" certain parts of it to do what you want. An example of what I'm saying is if you just wanted to zip a certain set of files (say your source files), you can easily write an Ant build file to do that, whereas with Maven it may be possible but you would need to jump through lots of hoops to get Maven to bypass all its "default" build process flow.

Does they play any role with kind of progamming used to build java app like struts, hibernate, spring?
Not really, because you still write your Java app in exactly the same way. It just changes your workflow when you are compiling/testing/packaging/deploying your app.

Note also, that both Ant and Maven can be used together! There are Ant tasks that can be used to run maven builds and handle dependencies like maven. Also, there are Maven plugins that can be used to execute ant builds. Finally, you can have a project that is built/managed by Maven and you can still manually run different Ant builds/tasks for those jobs that Ant handles better. It's totally up to the developer.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to implement Singleton Design Pattern in Java.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now