maven 手动安装jar包
Posted 魔有追求
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了maven 手动安装jar包相关的知识,希望对你有一定的参考价值。
maven 手动安装jar包
仓库位置
本地仓库位置
E:mozqapache-maven-3.6.1
epo
默认仓库位置
C:Users1.m2
epository
修改方式
<localRepository>E:mozqapache-maven-3.6.1
epo</localRepository>
参数
安装指定文件到本地仓库命令:mvn install:install-file
-Dmaven.repo.local 仓库位置
-DgroupId=<groupId>
-DartifactId=<artifactId>
-Dversion=1.0.0 版本号
-Dpackaging=jar 打包方式
-Dfile=<myfile.jar> jar文件位置
示例
# 注意:需要合并为一行
mvn install:install-file
-Dmaven.repo.local=E:mozqapache-maven-3.6.1
epo
-DgroupId=org.apache.poi
-DartifactId=poi
-Dversion=3.10.1
-Dpackaging=jar
-Dfile=E:mozqapache-maven-3.6.1jarspoi-3.10.1.jar
需要安装 poi 的jar包到自己设置的仓库
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.10.1</version>
</dependency>
安装到默认的仓库
mvn install:install-file -DgroupId=org.apache.poi -DartifactId=poi -Dversion=3.10.1 -Dpackaging=jar -Dfile=E:mozqapache-maven-3.6.1jarspoi-3.10.1.jar
C:Users1>mvn install:install-file -DgroupId=org.apache.poi -DartifactId=poi -Dversion=3.10.1 -Dpackaging=jar -Dfile=E:mozqapache-maven-3.6.1jarspoi-3.10.1.jar
[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:install-file (default-cli) @ standalone-pom ---
[INFO] Installing E:mozqapache-maven-3.6.1jarspoi-3.10.1.jar to C:Users1.m2
epositoryorgapachepoipoi3.10.1poi-3.10.1.jar
[INFO] Installing C:Users1AppDataLocalTempmvninstall4839632845182773472.pom to C:Users1.m2
epositoryorgapachepoipoi3.10.1poi-3.10.1.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.436 s
[INFO] Finished at: 2019-10-25T09:41:03+08:00
[INFO] ------------------------------------------------------------------------
错误:
Installing E:mozqapache-maven-3.6.1jarspoi-3.10.1.jar to C:Users1.m2
epositoryorgapachepoipoi3.10.1poi-3.10.1.jar
发现安装到了系统默认的仓库。
安装到指定的仓库
# -Dmaven.repo.local 指定仓库位置
-Dmaven.repo.local=E:mozqapache-maven-3.6.1
epo
# 安装到了指定本地仓库
[INFO] Installing E:mozqapache-maven-3.6.1jarspoi-3.10.1.jar to E:mozqapache-maven-3.6.1
epoorgapachepoipoi3.10.1poi-3.10.1.jar
C:Users1>mvn install:install-file -Dmaven.repo.local=E:mozqapache-maven-3.6.1
epo -DgroupId=org.apache.poi -DartifactId=poi -Dversion=3.10.1 -Dpackaging=jar -Dfile=E:mozqapache-maven-3.6.1jarspoi-3.10.1.jar
[INFO] Scanning for projects...
Downloading from alimaven: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-clean-plugin:2.5: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-clean-plugin:2.5: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom ---
[INFO] Installing E:mozqapache-maven-3.6.1jarspoi-3.10.1.jar to E:mozqapache-maven-3.6.1
epoorgapachepoipoi3.10.1poi-3.10.1.jar
[INFO] Installing C:Users1AppDataLocalTempmvninstall2352554239287225355.pom to E:mozqapache-maven-3.6.1
epoorgapachepoipoi3.10.1poi-3.10.1.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.866 s
[INFO] Finished at: 2019-10-25T09:54:56+08:00
[INFO] ------------------------------------------------------------------------
以上是关于maven 手动安装jar包的主要内容,如果未能解决你的问题,请参考以下文章