Which are the main advantages of Maven dependencies management? We have a versioned lib folder on the server and each developer just needs to import that directory in the IDE and keep it up to date. Could Maven be simpler than that?
Using a per-project lib seems like a simple solution and it is. But eventually you will run into problems:
foo.jar
from?foo.jar
exactly? Is it the original version or something that you patched?foo.jar
needs a.jar
which needs y.jar
which needs z.jar
needs ... You really want to download all that and manage it individually?foo.jar
to the next version. With Maven, this is a one-minute task. With a lib folder, it means: Searching the web, downloading the JAR, putting it in the right place, possible renaming it, deleting the old version, adding the new version, committing the change, cursing, doing the same for all dependencies, ...With maven you can have a private repository, or use public ones (like maven2) to obtain the libraries you use in your project, so you don't have to download them personally and manage them between your coworkers with your subversion server.
If you want to change one library for another one, or update it to a newer version you only have to modify the version number or the library name in your maven configuration file and it will be done, without care about where can you download the library from, and without having to share it with everyone. You will only have to share your pom.xml file.
Maven doesn't only give you this, you can configurate how to package the application (WAR, EAR, JAR, APK, etc.), compile it (JDK version, parameters, etc.) and even how to create the Eclipse structure of your project, so you can create a new project having only your sources, resources and the magic "pom.xml" maven configuration file.
You should give it a try!
Yes it can!
"each developer just need to import that dir in the ide and keep it up to date"
Maven does this automagically ;-)
Also it has big advantages if you use continous integration and other deployment mechanisms. You can easilly build your project in any environment without caring about some lib folders. Additially there are a lot of plugins regarding building, deployment, code analasys and many more.
Of course Maven is great, but there are also times when a versioned lib folder like yours can at least appear to be simpler. When you use libraries that don't have maven metadata, then you need to do some work before you can put it in your Maven Repo (you probably should still have one central repo on some server where you put such things).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With