登峰小蚁 2019-10-25
本地仓库位置 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
<!-- 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] ------------------------------------------------------------------------