Maven手动安装jar包(遇见pom无论如何都下载不了的依赖jar包处理方式)

1、什么时候需要手动安装jar包

Maven手动安装jar包(遇见pom无论如何都下载不了的依赖jar包处理方式)

有时候我们的maven项目会遇到无论怎么下载,怎么配置都有下载不了的jar包,这时候就需要我们手动安装jar包了。

比如下面这个maven-source-plugin,不论我如何操作,就是无法下载。

image

2、maven如何手动安装jar包

在idea的maven窗口中输入以下命令:

image

mvn install:install-file -Dfile=I:/360Download/maven-source-plugin-3.2.1.jar -DgroupId=org.apache.maven.plugins -DartifactId=maven-source-plugin -Dversion=3.2.1 -Dpackaging=jar

参数说明:

-Dfile : jar包的路径-DgroupId

-DgroupId : groupId

-DartifactId : artifactId

-Dversion : 版本号

四个参数都需要根据实际填写。

安装过程:

"C:\Program Files\Java\jdk-11.0.12\bin\java.exe" -Dmaven.multiModuleProjectDirectory=D:\DevYundoo\flowable-spring-boot -Dmaven.home=D:\Devtools\Maven-3.8.3 -Dclassworlds.conf=D:\Devtools\Maven-3.8.3\bin\m2.conf "-Dmaven.ext.class.path=C:\Program Files\JetBrains\IntelliJ IDEA 2020.3.3\plugins\maven\lib\maven-event-listener.jar" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2020.3.3\lib\idea_rt.jar=62344:C:\Program Files\JetBrains\IntelliJ IDEA 2020.3.3\bin" -Dfile.encoding=UTF-8 -classpath D:\Devtools\Maven-3.8.3\boot\plexus-classworlds-2.6.0.jar;D:\Devtools\Maven-3.8.3\boot\plexus-classworlds.license org.codehaus.classworlds.Launcher -Didea.version=2020.3.3 -s D:\Devtools\Maven-3.8.3\conf\settings.xml -Dmaven.repo.local=D:\Devtools\Maven-3.8.3\repository install:install-file -Dfile=I:/360Download/maven-source-plugin-3.2.1.jar -DgroupId=org.apache.maven.plugins -DartifactId=maven-source-plugin -Dversion=3.2.1 -Dpackaging=jar
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] flowable-spring-boot                                               [pom]
[INFO] flowable-spring-boot-starters                                      [pom]
[INFO] flowable-spring-boot-autoconfigure                                 [jar]
[INFO] flowable-spring-boot-starter-basic                                 [jar]
[INFO] Flowable - Spring Boot Process Starter                             [jar]
[INFO] flowable-spring-boot-starter-integration                           [jar]
[INFO] flowable-spring-boot-starter-actuator                              [jar]
[INFO] Flowable - Spring Boot App Starter                                 [jar]
[INFO] Flowable - Spring Boot CMMN Starter                                [jar]
[INFO] Flowable - Spring Boot DMN Starter                                 [jar]
[INFO] Flowable - Spring Boot Starter                                     [jar]
[INFO] Flowable - Spring Boot CMMN REST Starter                           [jar]
[INFO] Flowable - Spring Boot DMN REST Starter                            [jar]
[INFO] Flowable - Spring Boot Process REST Starter                        [jar]
[INFO] Flowable - Spring Boot App REST Starter                            [jar]
[INFO] flowable-spring-boot-starter-rest-api                              [jar]
[INFO] Flowable - Spring Boot REST Starter                                [jar]
[INFO] flowable-spring-boot-samples                                       [pom]
[INFO] flowable-spring-boot-sample-app                                    [jar]
[INFO] flowable-spring-boot-sample-process                                [jar]
[INFO] flowable-spring-boot-sample-jpa                                    [jar]
[INFO] flowable-spring-boot-sample-jpa-all                                [jar]
[INFO] flowable-spring-boot-sample-security                               [jar]
[INFO] flowable-spring-boot-sample-rest-api                               [jar]
[INFO] flowable-spring-boot-sample-rest-api-security                      [jar]
[INFO] flowable-spring-boot-sample-actuator                               [jar]
[INFO] flowable-spring-boot-sample-integration                            [jar]
[INFO] flowable-spring-boot-sample-custom-mybatis-mapper                  [jar]
[INFO] flowable-spring-boot-sample-dmn                                    [jar]
[INFO] flowable-spring-boot-sample-form                                   [jar]
[INFO] flowable-spring-boot-sample-content                                [jar]
[INFO] flowable-spring-boot-sample-cmmn                                   [jar]
[INFO] flowable-spring-boot-sample-ldap                                   [jar]
[INFO] flowable-spring-boot-sample-rest-1.5.x                             [jar]
[INFO] flowable-spring-boot-sample-starter                                [jar]
[INFO] 
[INFO] -----------------< org.flowable:flowable-spring-boot >------------------
[INFO] Building flowable-spring-boot 6.4.2                               [1/35]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ flowable-spring-boot ---
[INFO] Installing I:\360Download\maven-source-plugin-3.2.1.jar to D:\Devtools\Maven-3.8.3\repository\org\apache\maven\plugins\maven-source-plugin\3.2.1\maven-source-plugin-3.2.1.jar
[INFO] Installing C:\Users\ADMINI~1\AppData\Local\Temp\mvninstall3127720909105615021.pom to D:\Devtools\Maven-3.8.3\repository\org\apache\maven\plugins\maven-source-plugin\3.2.1\maven-source-plugin-3.2.1.pom
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for flowable-spring-boot 6.4.2:
[INFO] 
[INFO] flowable-spring-boot ............................... SUCCESS [  0.811 s]
[INFO] flowable-spring-boot-starters ...................... SKIPPED
[INFO] flowable-spring-boot-autoconfigure ................. SKIPPED
[INFO] flowable-spring-boot-starter-basic ................. SKIPPED
[INFO] Flowable - Spring Boot Process Starter ............. SKIPPED
[INFO] flowable-spring-boot-starter-integration ........... SKIPPED
[INFO] flowable-spring-boot-starter-actuator .............. SKIPPED
[INFO] Flowable - Spring Boot App Starter ................. SKIPPED
[INFO] Flowable - Spring Boot CMMN Starter ................ SKIPPED
[INFO] Flowable - Spring Boot DMN Starter ................. SKIPPED
[INFO] Flowable - Spring Boot Starter ..................... SKIPPED
[INFO] Flowable - Spring Boot CMMN REST Starter ........... SKIPPED
[INFO] Flowable - Spring Boot DMN REST Starter ............ SKIPPED
[INFO] Flowable - Spring Boot Process REST Starter ........ SKIPPED
[INFO] Flowable - Spring Boot App REST Starter ............ SKIPPED
[INFO] flowable-spring-boot-starter-rest-api .............. SKIPPED
[INFO] Flowable - Spring Boot REST Starter ................ SKIPPED
[INFO] flowable-spring-boot-samples ....................... SKIPPED
[INFO] flowable-spring-boot-sample-app .................... SKIPPED
[INFO] flowable-spring-boot-sample-process ................ SKIPPED
[INFO] flowable-spring-boot-sample-jpa .................... SKIPPED
[INFO] flowable-spring-boot-sample-jpa-all ................ SKIPPED
[INFO] flowable-spring-boot-sample-security ............... SKIPPED
[INFO] flowable-spring-boot-sample-rest-api ............... SKIPPED
[INFO] flowable-spring-boot-sample-rest-api-security ...... SKIPPED
[INFO] flowable-spring-boot-sample-actuator ............... SKIPPED
[INFO] flowable-spring-boot-sample-integration ............ SKIPPED
[INFO] flowable-spring-boot-sample-custom-mybatis-mapper .. SKIPPED
[INFO] flowable-spring-boot-sample-dmn .................... SKIPPED
[INFO] flowable-spring-boot-sample-form ................... SKIPPED
[INFO] flowable-spring-boot-sample-content ................ SKIPPED
[INFO] flowable-spring-boot-sample-cmmn ................... SKIPPED
[INFO] flowable-spring-boot-sample-ldap ................... SKIPPED
[INFO] flowable-spring-boot-sample-rest-1.5.x ............. SKIPPED
[INFO] flowable-spring-boot-sample-starter ................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.979 s
[INFO] Finished at: 2021-11-21T16:19:04+08:00
[INFO] ------------------------------------------------------------------------

进程已结束,退出代码0

检查maven的本地仓,查看是否安装成功:

image

或者也可以直接去maven官网下载对应的四个包到本地文件夹:

https://repo1.maven.org/maven2/org/apache/maven/plugins/maven-source-plugin/3.2.1/

image

本地仓目录:

image

3、重新加载工程

reimport即可

大T笔记所有文章均为本人原创,转载请您注明来源,并留下原文链接地址,是对我的尊重,也是对知识的尊重,谢谢!
大T笔记 » Maven手动安装jar包(遇见pom无论如何都下载不了的依赖jar包处理方式)

大T笔记-我的个人互联网创业和自由职业之路

关于我 我的百宝箱
大T笔记-专注个人互联网创业和自由职业