Idea中maven項目中導入本地jar包


說一下正確的流程:

1、將jar包導入到本地maven庫或者遠程nexus倉庫,再使用maven引用:

2、導入命令:

//通過一下信息引入maven
-DgroupId=com.test -DartifactId=SDK_API -Dversion=1.0.0
//命令eg:
mvn install:install-file -DgroupId=com.test -DartifactId=SDK_API -Dversion=1.0.0 -Dpackaging=jar -Dfile=D:\lib\SDK_API.jar

  

需要注意,導入本地maven庫的jar包在雲環境下會編譯失敗!

 

個人案例:

zxdeMacBook-Pro:Desktop zhangxu$ 
zxdeMacBook-Pro:Desktop zhangxu$ mvn install:install-file -DgroupId=com.dt.robot -DartifactId=DingTalkSDK -Dversion=1.0.0 -Dpackaging=jar -Dfile=/Users/zhangxu/Desktop/taobao-sdk-java.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 /Users/zhangxu/Desktop/taobao-sdk-java.jar to /Users/zhangxu/mvnRepo/com/dt/robot/DingTalkSDK/1.0.0/DingTalkSDK-1.0.0.jar
[INFO] Installing /var/folders/0r/9zdkjhjj4m9g5chkpby408fw0000gn/T/mvninstall13347744715825280666.pom to /Users/zhangxu/mvnRepo/com/dt/robot/DingTalkSDK/1.0.0/DingTalkSDK-1.0.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.547 s
[INFO] Finished at: 2019-06-26T16:48:07+08:00
[INFO] ------------------------------------------------------------------------
zxdeMacBook-Pro:Desktop zhangxu$ 

  引入包:

	<dependency>
			<groupId>com.dt.robot</groupId>
			<artifactId>DingTalkSDK</artifactId>
			<version>1.0.0</version>
		</dependency>

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM