How to include system dependencies in war built using maven

Let me try to summarise the options I tried :

<packagingIncludes>${java.home}/lib/jfxrt.jar</packagingIncludes>

This doesn’t work! Also, only having the jar name, excludes everything else, so if you are willing to try then try

<packagingIncludes>${java.home}/lib/jfxrt.jar,**/*</packagingIncludes>

Jatin’s answer seemed a bit complex and I tried going through the POM again & again to figure out where exactly were the system jars mentioned to be included in WEB-INF POM.

Anyways, I ended up using this solution, which wasn’t working at first but after some time and some corrections worked :

I installed the jar in my local repository using the below command :

mvn install:install-file -Dfile="C:\Users\hp\Documents\NetBeansProjects\TwitterAndLoginRadiusMaven\lib\LoginRadius-1.0.jar" -DgroupId=LoginRadius -DartifactId=LoginRadius -Dversion=1.0 -Dpackaging=jar`

After running the above command, I changed the dependency in POM to

<dependency>
   <groupId>LoginRadius</groupId>
   <artifactId>LoginRadius</artifactId>
   <!--<scope>system</scope>-->
   <version>1.0</version>
   <!--<systemPath>${basedir}\lib\LoginRadius-1.0.jar</systemPath>-->
</dependency>

NOTE – See I’ve commented the system scope & systemPath.

Building the war now, includes this LoginRadius-1.0.jar in WEB-INF/lib

Leave a Comment