views:

248

answers:

7

I would like to know the reasons people use or not use Maven. We are about to switch all our builds to Maven 2 and don't have to much experience with it.

What are the advantages/disadvantages of using Maven 2, stuff like:

  • Why did you switch to maven?
  • Why did you throw maven away and used something else?
  • What problem did it solve for you?
  • What problem did it cause for you?

Thank you!

A: 

Perhaps this may make you feel good! :)

pavanlimo
+4  A: 

I have used maven in every project I have encountered over the last 4 years or so, ranging from private mini-projects to huge enterprise dozens-of-modules projects and I have never once regretted using maven.

I have built anything from standard java JAR / WAR / EAR projects to flex / AIR apps and Linux RPMs using maven, delegating to either Antrun or GMaven when no maven plugin was available for a given situation.

The power and comfort of the standard maven lifecycle combined with the abundance of available plugins for code generation, documentation, code metrics etc that are usually all easy to use makes maven the only real choice for java build systems.

Go ahead and bash it, but until you invent something better, I'll keep using it.

seanizer
I agree wholeheartedly. With polyglot maven you don't even need to use xml anymore which in my opinion is one of the downsides of maven. For complex projects the pom quickly becomes very large. On the other hand if you're using a pom editor like the one provided by m2eclipse you don't have to deal with it directly for most cases anyway. Nevertheless polyglot maven rules :)
Raoul Duke
A: 

I started with maven and I stay with it. When I build a project with maven I never have problems with missing liraries, wrong libraries versions, ... It compiles, it runs.

Libraries upgrade is simple (not like Ant).

Maven provides many usefull plugins. I use maven to run functionality testing on hudson - it downloads newest version of my project, starts embedded database, injects dbunit dataset, deploys application on jetty, runs test, renders test results.

One thing I don't like is to have everythink in one file. Then I would like to specify configuration not only using XML.

amra
+3  A: 

The great advantage of using Maven is its repository infrastructure. This promotes standard protocols for the sharing of 3rd party libraries and enables teams to collaborate more effectively without being forced to check everything into the same source code repository (Modular builds).

Repository managers are freely available and I'd recommend installing one of the following:

  • Nexus
  • Artifactory
  • Archiva

The good news is that you're not forced to build your code using Maven in order to utllize the benefits of having a Maven infrastructure.

I recommend Maven for "Green field" projects without a legacy to defend. The start of a project is generally the best time to introduce a new technology and the benefits of using Maven are well documented. The high-lights being a standardised build process and a wealth of 3rd party plugins.

ANT projects can be re-engineered to inter-operate with teams using Maven. The ivy plugin, applied properly, can actually simplify the ANT build process. Ivy is able to manage the project's classpath by downloading dependencies from the Maven repository and afterwards publishing the build artifacts (Just like a Maven "deploy").

Finally ivy is been embedded into other build tools. Examples are new build tools like Gradle, simple-build-tool and development systems like Grails. So embrace the use of an Enterprise Maven repository and choose the build tool that is appropriate for the project team.

Mark O'Connor
A: 

I agree with Mark that it's great for greenfield projects. There is a bit of an overhead to get it up and running in your development environment, but it is well worth it.

I might add that a potential danger to using Maven is that if you are working on a large project, it may become difficult to maintain the jars in the repository. You can potentially end up using several different versions of jars in your POM.xml's.

As with any project, make sure that you have good policies and procedures in place for bringing in different Jars into your code base. These jars can have different licenses that may expose your code base to the open source world. Make sure these licenses are reviewed by your.

It Grunt
+1  A: 

Maven is fantastic!

I don't have as much time to wax lyrical as I would like, but here are my top few benefits of Maven, in no particular order:

  • Repeatable builds: if you can build the project, your colleagues will always be able to on their machines. It'll also be repeatable on the build server.
  • Standardisation of the build system: new developers who understad Maven will instantly know how to build, release, test etc, removing a lot of learning overhead.
  • Focus on automation: Maven puts you in a mindset of automating processes around your software development.
  • Convention over configuration: no setup or minimal configuration required to build artifacts.
  • Dependency management: Maven will resolve and manage your dependencies for you.
  • Testing: the ability to run tests and integration tests as part of your project lifecycle.
  • Plugins: there are thousands of plugins to carry out various tasks. These are simply configured in just by adding a reference into the POM.

In terms of downsides, it is often said that you are better off accepting the Maven defaults and conventions, and ideally starting to use it at the outset of a greenfield project. I would agree with this to a degree if you want to save time configuring XML in your POM.

I'm not really a tool zealot, but having used Make and Ant before Maven, I really can't see a single downside to adopting Maven. It's a quality tool and a real time saver.

A: 

Maybe you should checkout this other post on SO.

People are talking about the reasons they like or dislike using Maven, so if you want answers to your questions (what problem did it solve for you? what problem did it cause for you? etc) you should get some useful answers there.

dpb
Why the down vote? Please leave a comment.
dpb