Using Maven Dependency Projects

Markus Eisele
Maven is number one in managing dependencies. This could get even simpler, if you use plugins for your favourite ide (e.g. m2eclipse).
Anyway, dependency management is the most challinging part in maven projects. If you have a growing project, you should sit back and think about the project structure and the needed dependencies a bit.
Best practice building jee applications for me is to use so called "dependency projects". If you have your web project you simply add another project called web-deps of type pom and link a dependency to it from your web project. Now you have a single place, where you can manage all your dependencies for your web project.

There are several advantages of this approach:
* One central place to manage all dependencies of your web/ejb projects. You can have some web-tools projects that depend on the deps. This helps preventing circles.
* Assign one responsible person in your project managing the deps.
* Easier change container dependencies. By only adding new deps projects and not breaking the actuall build. This gives you the option to have one deps project per container for example (e.g. web-deps-wls, web-deps-was).

Follow the other parts of this series:

Download the complete Quickstart Maven JEE5 Project.

Post a Comment


Post a Comment (0)