• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dependencies(local jars) shared by all projects

 
Njnamrata Shah
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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,
<dependency>
<groupId>addjar</groupId>
<artifactId>addj1</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${lib_path}/ACLAgent4.0.jar</systemPath>
</dependency>
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.

Thanks,
Namrata Shah
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
Njnamrata Shah
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Peter,

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

Thanks,
Namrata Shah
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic