HiveBrain v1.2.0
Get Started
← Back to all entries
snippetjavaCritical

How can I add local JAR files to a Maven project?

Submitted by: @import:stackoverflow-api··
0
Viewed 0 times
projectmavenhowfilesaddcanjarlocal

Problem

How do I add local JAR files (not yet part of the Maven repository) directly in my project's library sources?

Solution

Install the JAR file into your local Maven repository (typically .m2 in your home folder) as follows:
mvn install:install-file \
-Dfile= \
-DgroupId= \
-DartifactId= \
-Dversion= \
-Dpackaging= \
-DgeneratePom=true


Where each refers to:

`: the path to the file to load, e.g, c:\kaptcha-2.3.jar

: the group that the file should be registered under, e.g., com.google.code

: the artifact name for the file, e.g, kaptcha

: the version of the file, e.g., 2.3

: the packaging of the file, e.g., jar

Reference

  • Maven FAQ: I have a JAR file that I want to put into my local repository. How can I copy it in?



  • Maven Install Plugin Usage: The install:install-file` goal

Context

Stack Overflow Q#4955635, score: 1139

Revisions (0)

No revisions yet.