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:
- Adding additional Source Folders to Maven Project
- Generating Static WAR Content Archive with Maven
- Quickstart Maven JEE5 Project
Download the complete Quickstart Maven JEE5 Project.