Maven 将 jar 包安装到本地仓库。

Maven 将 jar 包安装到本地仓库。


在这里插入图片描述

想通过 Maven 导入 jar 包,而 Maven 中央仓库(Mavenrepository)和本地仓库都没有,就会报错。

这时我们可以将 jar 包安装到本地 Maven 仓库。

mvn install:install-file -DgroupId=com.arcsoft.face -DartifactId=arcsoft-sdk-face -Dversion=2.2.0.1 -Dpackaging=jar -Dfile=arcsoft-sdk-face-2.2.0.1.jar

  • mvn install:install-file 的参数。

https://maven.apache.org/plugins/maven-install-plugin/usage.html

mvn install:install-file -Dfile=your-artifact-1.0.jar \
                         [-DpomFile=your-pom.xml] \
                         [-Dsources=src.jar] \
                         [-Djavadoc=apidocs.jar] \
                         [-DgroupId=org.some.group] \
                         [-DartifactId=your-artifact] \
                         [-Dversion=1.0] \
                         [-Dpackaging=jar] \
                         [-Dclassifier=sources] \
                         [-DgeneratePom=true] \
                         [-DcreateChecksum=true]

看看官网介绍。

Apache Maven Install Plugin
The Install Plugin is used during the install phase to add artifact(s) to the local repository. The Install Plugin uses the information in the POM (groupId, artifactId, version) to determine the proper location for the artifact within the local repository.
The local repository is the local cache where all artifacts needed for the build are stored. By default, it is located within the user’s home directory (~/.m2/repository) but the location can be configured in ~/.m2/settings.xml using the element.

  • Goals Overview

The Install Plugin has 3 goals:

  • install:install
    is used to automatically install the project’s main artifact (the JAR, WAR or EAR), its POM and any attached artifacts (sources, javadoc, etc) produced by a particular project.
  • install:install-file
    is mostly used to install an externally created artifact into the local repository, along with its POM. In that case the project information can be taken from an optionally specified pomFile, but can also be given using command line parameters.
  • install:help
    displays help information on maven-install-plugin.
D:\lyfGeek。download。\ArcSoft_ArcFace_Java_Windows_x64_V2.2\libs>E:\lyfGeek\apache-maven-3.6.3\bin\mvn install:help
[WARNING]
[WARNING] Some problems were encountered while building the effective settings
[WARNING] Unrecognised tag: 'id' (position: START_TAG seen ...</profile>\r\n    -->\r\n\r\n    <id>... @222:9)  @ E:\lyfGeek\apache-maven-3.6.3\bin\..\conf\settings.xml, line 222, column 9
[WARNING]
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:help (default-cli) @ standalone-pom ---
[INFO] Maven Install Plugin 2.4
  Copies the project artifacts to the user's local repository.

This plugin has 3 goals:

install:help
  Display help information on maven-install-plugin.
  Call mvn install:help -Ddetail=true -Dgoal=<goal-name> to display parameter
  details.

install:install
  Installs the project's main artifact, and any other artifacts attached by
  other plugins in the lifecycle, to the local repository.

install:install-file
  Installs a file in the local repository.


[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.948 s
[INFO] Finished at: 2020-09-24T16:21:25+08:00
[INFO] ------------------------------------------------------------------------
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

lyfGeek

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值