How to add local jar files to a Maven project?

后端 未结 30 3243
悲&欢浪女
悲&欢浪女 2020-11-21 04:58

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

30条回答
  •  悲&欢浪女
    2020-11-21 05:06

    Install the JAR into your local Maven repository 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 that I want to put into my local repository. How can I copy it in?
    • Maven Install Plugin Usage: The install:install-file goal

提交回复
热议问题