sridhar
sridhar

Reputation: 1157

How to build a jar containing only dependency jars in pom

I am new to maven tool. I would like to build a jar containing only dependency jars in pom and also parent pom and deploy this as shared library in the server.

Could you help me out about the maven plugin and the steps involved to build this jar.

Upvotes: 0

Views: 666

Answers (2)

khmarbaise
khmarbaise

Reputation: 97359

The best setup for such purpose is to use the maven-shade-plugin which creates a jar which contains all project dependencies.

Upvotes: 1

uchideshi
uchideshi

Reputation: 19

I just verified this on one of my projects.

Make sure that your maven installation is on your path and change to the directory that contains your project using a terminal emulator or cmd.exe (in windows).

Run the following command:

mvn dependency:copy-dependencies

your dependencies will be downloaded to the target->dependency directory in your project

Upvotes: 0

Related Questions