Add jar package to local MAVEN repository

Source: Internet
Author: User

In the process of using MAVEN, it is common to encounter some jar packages that are not in the central repository. If the company has a business, install the jar package on the. If there is no one, install the jar package to the local Maven repository. Today you'll get to the bottom of the 2 ways to install jar packages to your local maven repository.
One, install the jar package with the MAVEN commandpremise: In the Windows operating system configured MAVEN environment variables, how to configure please yourself Baidu, here is not introduced, canReferenceHttps://jingyan.baidu.com/article/cb5d61050b8ee7005d2fe04e.html
under the cmd command for Windows, refer to the following installation command to install the jar package. Note: This command cannot be wrapped, separated by a space in the middle.
  
 
  1. 安装指定文件到本地仓库命令:mvn install:install-file
  2. -DgroupId=<groupId> : 设置项目代码的包名(一般用组织名)
  3. -DartifactId=<artifactId> : 设置项目名或模块名
  4. -Dversion=1.0.0 : 版本号
  5. -Dpackaging=jar : 什么类型的文件(jar包)
  6. -Dfile=<myfile.jar> : 指定jar文件路径与文件名(同目录只需文件名)
  7. 安装命令实例:
  8. mvn Install : Install - file - DgroupId = com . Baidu - DartifactId = Ueditor - Dversion = 1.0.0 -dpackaging=jar -dfile= Ueditor - 1.1 . 2.jar
after executing the command, you can see the success word, indicating that the installation was successful, can be found in the local warehouse. Ii. Installing the jar package with eclipseThere is also a prerequisite for using Eclipse installation, which is that the eclipse MAVEN needs to be configured first. But I do believe that the MAVEN settings of the eclipse, which is the only one of my friends, are sure to be fine, or maven.
Specific operation:
(1) File-->import-->maven-->instal or deploy an artifact to a Maven repository

(2) Fill in the relevant information, such as MAVEN coordinates, specific reference. Click Finish when you are finished.
(3) after the completion of the above steps, it is already done, you can go to the local warehouse to see the above installed things are not.
Comparison of the two schemesScenario One: The drawback is that it is cumbersome, for example to configure environment variables, and to write lengthy installation commands. However, if you configure the environment variables, it's easy. Copy the example of an installed command, and then install it directly. Scenario Two: Need Eclipse, personal recommendation this way, relatively simple.




Add jar package to local MAVEN repository

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.