How do I add local jar files (not yet part of the Maven repository) directly in my project\'s library sources?
Step 1: Configure the maven-install-plugin
with the goal install-file
in your pom.xml
org.apache.maven.plugins
maven-install-plugin
install-external-non-maven-jar-MWS-Client-into-local-maven-repo
clean
default
com.amazonservices.mws
mws-client
1.0
${project.basedir}/lib/MWSClientJavaRuntime-1.0.jar
jar
true
install-file
Make sure to edit the file
path based on your actual file path (recommended is to place these external non-maven jars inside some folder, let's say lib
, and place this lib
folder inside your project so as to use project-specific relative path and avoid adding system specific absolute path.
If you have multiple external jars, just repeat the
for other jars within the same maven-install-plugin
.
Step 2: Once you have configured the maven-install-plugin
as shown above in your pom.xml
file, you have to use these jars in your pom.xml
as usual:
com.amazonservices.mws
mws-client
1.0
Note that the maven-install-plugin
only copies your external jars to your local .m2
maven repository. That's it. It doesn't automatically include these jars as maven dependencies to your project.
It's a minor point, but sometimes easy to miss.