File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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
Author

Dependencies(local jars) shared by all projects

Njnamrata Shah
Greenhorn

Joined: Oct 01, 2012
Posts: 8
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

Joined: May 14, 2008
Posts: 5845
    
    7

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
Greenhorn

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

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

Thanks,
Namrata Shah
 
 
subject: Dependencies(local jars) shared by all projects