john
john

Reputation: 707

How to include JARs in WAR archive WEB-INF/lib using Maven?

My Maven pom file builds a war without the dependencies, so that i have to manually add them to the WEB-INF/lib.

Is there any way to instruct Maven to include all the dependencies within the war ? So the the war become self content and independent

Upvotes: 1

Views: 3612

Answers (2)

ranjithkr
ranjithkr

Reputation: 604

Yes, make sure the packaging is of type war like <packaging>war</packaging>. Also check if the dependencies in your pom are of the right scope, for example if they are not default or the compile scope, that's possibly why they are not bundled into the war's lib folder.

<dependency>
 ..
 ..
 <scope>compile</scope>
<dependency>

Upvotes: 1

gtosto
gtosto

Reputation: 1341

Just make sure the type of your pom is war. Maven's default behavior is to copy dependencies in the lib folder. P.S. If you found any trouble post your full pom. Besides see maven war plugin for further doc

Upvotes: 2

Related Questions