How to add local jar files to a Maven project?

后端 未结 30 3246
悲&欢浪女
悲&欢浪女 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:24

    1. mvn install

    You can write code below in command line or if you're using eclipse builtin maven right click on project -> Run As -> run configurations... -> in left panel right click on Maven Build -> new configuration -> write the code in Goals & in base directory :${project_loc:NameOfYourProject} -> Run

    mvn install:install-file
       -Dfile=
       -DgroupId=
       -DartifactId=
       -Dversion=
       -Dpackaging=
       -DgeneratePom=true
    

    Where each refers to:

    < path-to-file >: the path to the file to load e.g -> c:\kaptcha-2.3.jar

    < group-id >: the group that the file should be registered under e.g -> com.google.code

    < artifact-id >: the artifact name for the file e.g -> kaptcha

    < version >: the version of the file e.g -> 2.3

    < packaging >: the packaging of the file e.g. -> jar

    2.After installed, just declares jar in pom.xml.

     
          com.google.code
          kaptcha
          2.3
     
    

提交回复
热议问题