Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I've spend a few hours playing around with Maven + reading some stuff on the apache official site and also a few random googled articles. By this I mean that I really tried to find the answers myself - both by reading and by doing things on my own. Also maybe worth to mention that I installed the m2e plugin so most of the time I've tried things out from Eclipse and not using the command line too much.

However aside from the generated project that for example prevent me from using the default package I didn't see that much of a difference with the standard way I've created my projects before try Maven. In fact I've almost decided to skip Maven for now and move on to the other technology I wanted to learn more in-depth - Hibernate, but when I start with opening the official page the first thing I've read was the recommendation to use Hibernate with Maven.

That get me confused and made me taking a step back and trying once more to find what I'm obviously missing right now.

As it's said in the maven.apache.. site, the true strength of Maven is shown when you work on large projects with other people, but I lack the option to see how Maven is really used in this scenario, still i think that there are maybe advantages even when it comes to working with small projects alone, but I really have difficulties to point them out.

So what do you think are the advantages of Maven when it's used for small projects writing from a single person. What are the things that I should be aware of and try to exploit (I mean features offered by Maven) that can come in handy in this situations?

share|improve this question
2  
I would recommend that you actually use Maven from the command line - it's really quite simple and sooner or later you'll need to use some of the more advanced features of Maven which might not be exposed in the UI in your IDE. Also, all the tutorials will tell you how to do things using the command line, so it's easier to follow along. Once you understand how to use Maven on the command line, it'll be easier for you to start using a UI to do it for you as you know what it's doing under the hood. –  Nate W. Nov 28 '12 at 1:19
    
I'm curious about the close vote here. This seems like a completely legitimate question to me. –  Eric Wilson Nov 28 '12 at 12:57
    
Not much reason to use Maven on trivial projects. Most course work is trivial. –  Rig Nov 28 '12 at 20:02
add comment

2 Answers

up vote 7 down vote accepted

I find the management of dependencies a big win even for solo projects. Adding some XML to the pom.xml and letting Maven worry about downloading the JAR, and putting it in the right place is really convenient.

Using the command line for building and deploying is usually much quicker. Once you have some commands in the history, six keystrokes can build, run all tests, and deploy to Tomcat. Building with Eclipse and deploying through the Tomcat Manager is about 12 careful clicks.

Even if your project stays solo, you may want to use a different machine at some point. With Maven, there is no need to have JARs in version control, just clone your GitHub repo, and mvn package will get everything you need.

Finally, you wouldn't learn Hibernate if you didn't plan on working on big projects. These days, most of those big products are built with Maven, so your time won't be wasted.

One tip: Make sure to install the Eclipse m2 plugin, otherwise Eclipse won't understand your code.

share|improve this answer
    
Thanks, this is the first clue I get so I'm gonna take a closer look at it. About the tip, I have installed m2e which I think is the plugin for Eclipse or you meant something different? –  Leron Nov 27 '12 at 21:43
    
That's the one I meant. –  Eric Wilson Nov 28 '12 at 12:55
2  
You mention that maven automates some essential steps for deployment ("six keystrokes can build, run all tests, and deploy to Tomcat"), but I think it's important to make it clear that this is saving you the time and trouble of writing an ant script to do all those things. Ant probably has plugins to simplify those steps, but when you can create a simple pom.xml and run mvn test and have it locate and run all your tests? That's a great feature. –  Mike Partridge Nov 28 '12 at 15:25
    
Agreed, I was steering clear of Ant vs Maven, but I prefer Maven for that reason. –  Eric Wilson Nov 28 '12 at 17:47
add comment

Maven and similar tools automate a whole load of tedious tasks. Eclipse automates some of the same tasks - compiling, packaging, running tests, starting a webapp container (if you're using WTP). So, if you're comparing Eclipse with a build tool to Eclipse without a build tool, the difference will not be so big, at least for a small project.

As Eric points out, one big win is dependency management. If your project has few dependencies outside the JDK, then this you may not perceive how useful this is. Wait until it's grown to having a couple of dozen dependencies, then try removing the build tool and see how much pain you feel!

I should add that although Maven is the most widely-used sophisticated build tool, it isn't the only one, and in my opinion, not the best. Maven is rather inflexible and overcomplicated; its successors, chiefly Gradle and Buildr, are hugely more flexible, and much simpler to use, making easy things easy and difficult things possible. I would strongly encourage you to not use Maven at all, and to either use Gradle, or to try Gradle and Buildr,and use the one you prefer.

share|improve this answer
1  
+1 for Gradle, or anything that doesn't require human-written XML. –  kevin cline Nov 28 '12 at 19:35
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.