mvn add jar file to local repository

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

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