wood burning stoves 2.0*
The moose likes Ant, Maven and Other Build Tools and the fly likes Dependencies(local jars) shared by all projects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Dependencies(local jars) shared by all projects" Watch "Dependencies(local jars) shared by all projects" New topic

Dependencies(local jars) shared by all projects

Njnamrata Shah

Joined: Oct 01, 2012
Posts: 8

I am having 14 projects at apache-tomcat-7.0.30/webapps.
all projects having it's pom.xml.
I need to add 70 local jar files as dependency while building the project.

Instead of adding,
for 70 jars in each(14) projects,

Is there any way to add these dependency local jar files to maven once
and making all projects to share these dependency.

Any help is appreciated.

Namrata Shah
Peter Johnson

Joined: May 14, 2008
Posts: 5812

Yes, there are two ways to do this.

a) Create a parent POM that includes all of those JARs as dependencies and then have each of your project declare that parent POM.

b) Create a stand-alone POM that declares all of those JAR as dependencies and then include that POM as a dependency in all of your projects.

I usually use option (a) - essentially what you are doing is defining a POM for a type of web application; and then all web applications of that type use that POM as the parent POM. I usually find it handy to have a parent POM for each application type that I will be creating, and in some cases I use a hierarchy of parent POMs, each one adding additional functionality. For example, my root POM has only licensing information and the URL for my employer. Then I have separate sub-POMs for various different application types, some of which add dependencies, others of which add plugins (for example, for building the javadoc and source jars), and then others that are more focused on specific project types (for example, all Spring MVC projects have a common parent POM).

JBoss In Action
Njnamrata Shah

Joined: Oct 01, 2012
Posts: 8
Hi Peter,

Thanks for your help. It has fixed out my query.
Thank you again.

Namrata Shah
subject: Dependencies(local jars) shared by all projects
Similar Threads
java.util.MissingResourceException: Can't find bundle for base name in JSF Spring Maven project
Java Security Exception
How to avoid using systemPath and make maven read jars from /lib
Could not resolve dependencies for maven project
Problem in generating client code from wsdl using maven + axis2