Did you ever want to put a local jar library file into your deployment jar file, but the library file is not available on public repository (or you don’t want to put it on public repository?)
One possible method is to add maven dependency with scope and systemPath property
<dependency>
<groupId>aeszip</groupId>
<artifactId>aeszip</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/WebContent/WEB-INF/lib/aeszip.jar</systemPath>
</dependency>
But using scope and systemPath has a problem, that is when I run mvn package
to build a package, the dependency will not be included, so running the application on another machine will always complain NoClassDefFoundError or ClassNotFoundException
So a better method is to use mvn install:install-file
plugin
mvn install:install-file -Dfile=UPay/JHPaymentChannelPro/lib/AesZip.jar -DgroupId=aeszip -DartifactId=aeszip -Dversion=1.0 -Dpackaging=jar
This will add AesZip.jar to your local maven repository. When running mvn package
to create package, the dependent libraries will be included into the generated package
The post mvn add jar file to local repository appeared first on Redino blog.