码迷,mamicode.com
首页 > 编程语言 > 详细

maven 手动安装jar包

时间:2019-10-25 11:46:50      阅读:75      评论:0      收藏:0      [点我收藏+]

标签:mave   and   fail   warning   ima   nis   osi   poi   仓库   

maven 手动安装jar包

仓库位置

本地仓库位置
E:\mozq\apache-maven-3.6.1\repo
默认仓库位置
C:\Users\1\.m2\repository
修改方式
<localRepository>E:\mozq\apache-maven-3.6.1\repo</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:\mozq\apache-maven-3.6.1\repo 
-DgroupId=org.apache.poi 
-DartifactId=poi 
-Dversion=3.10.1 
-Dpackaging=jar 
-Dfile=E:\mozq\apache-maven-3.6.1\jars\poi-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:\mozq\apache-maven-3.6.1\jars\poi-3.10.1.jar

C:\Users\1>mvn install:install-file -DgroupId=org.apache.poi -DartifactId=poi -Dversion=3.10.1 -Dpackaging=jar -Dfile=E:\mozq\apache-maven-3.6.1\jars\poi-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:\mozq\apache-maven-3.6.1\jars\poi-3.10.1.jar to C:\Users\1\.m2\repository\org\apache\poi\poi\3.10.1\poi-3.10.1.jar
[INFO] Installing C:\Users\1\AppData\Local\Temp\mvninstall4839632845182773472.pom to C:\Users\1\.m2\repository\org\apache\poi\poi\3.10.1\poi-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:\mozq\apache-maven-3.6.1\jars\poi-3.10.1.jar to C:\Users\1\.m2\repository\org\apache\poi\poi\3.10.1\poi-3.10.1.jar
发现安装到了系统默认的仓库。

安装到指定的仓库

# -Dmaven.repo.local 指定仓库位置
-Dmaven.repo.local=E:\mozq\apache-maven-3.6.1\repo

# 安装到了指定本地仓库
[INFO] Installing E:\mozq\apache-maven-3.6.1\jars\poi-3.10.1.jar to E:\mozq\apache-maven-3.6.1\repo\org\apache\poi\poi\3.10.1\poi-3.10.1.jar
C:\Users\1>mvn install:install-file -Dmaven.repo.local=E:\mozq\apache-maven-3.6.1\repo -DgroupId=org.apache.poi -DartifactId=poi -Dversion=3.10.1 -Dpackaging=jar -Dfile=E:\mozq\apache-maven-3.6.1\jars\poi-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:\mozq\apache-maven-3.6.1\jars\poi-3.10.1.jar to E:\mozq\apache-maven-3.6.1\repo\org\apache\poi\poi\3.10.1\poi-3.10.1.jar
[INFO] Installing C:\Users\1\AppData\Local\Temp\mvninstall2352554239287225355.pom to E:\mozq\apache-maven-3.6.1\repo\org\apache\poi\poi\3.10.1\poi-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包

标签:mave   and   fail   warning   ima   nis   osi   poi   仓库   

原文地址:https://www.cnblogs.com/mozq/p/11737064.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!