原文地址: https://www.ddmit.com/maven-install-local-jar/
在使用Maven管理依赖时,有时第三方Jar包必须得下载下来本地使用,这里总结maven配置本地依赖的几种方式。
方式一 安装jar文件包到本地仓库
mvn install:install-file -Dfile=D:\workspace\xf-cloud\lib\taobao-sdk-java-auto_1479188381469-20210727.jar -DgroupId=com.dingtalk -DartifactId=dingtalk-api-sdk -Dversion=1.0.0-SNAPSHOT -Dpackaging=jar -DgeneratePom=true
安装过程如下:
C:\Users\Winbert>mvn install:install-file -Dfile=D:\workspace\xf-cloud\lib\taobao-sdk-java-auto_1479188381469-20210727.jar -DgroupId=com.dingtalk -DartifactId=dingtalk-api-sdk -Dversion=1.0.0-SNAPSHOT -Dpackaging=jar -DgeneratePom=true
[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 D:\workspace\xf-cloud\lib\taobao-sdk-java-auto_1479188381469-20210727.jar to D:\ProgramData\maven-repository\com\dingtalk\dingtalk-api-sdk\1.0.0-SNAPSHOT\dingtalk-api-sdk-1.0.0-SNAPSHOT.jar
[INFO] Installing C:\Users\Winbert\AppData\Local\Temp\mvninstall6463484044721168508.pom to D:\ProgramData\maven-repository\com\dingtalk\dingtalk-api-sdk\1.0.0-SNAPSHOT\dingtalk-api-sdk-1.0.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.512 s
[INFO] Finished at: 2021-08-09T00:12:30+08:00
[INFO] ------------------------------------------------------------------------
方式二 配置pom文件
<dependency>
<groupId>com.dingtalk</groupId>
<artifactId>dingtalk-api-sdk</artifactId>
<version>1.0.0-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${pom.basedir}/lib/taobao-sdk-java-auto_1479188381469-20210727.jar</systemPath>
</dependency>
配置插件,打包时将本地jar文件打入:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
Reference
最新评论
我的是ipv4网络,如何使用直播源啊!
我今天试了,不想啊,我的是新疆昌吉移动的网络。
收不到验证码电报
现在充值29起了