Jenkins打包-使用本地jar包


一、使用背景

1.xxx-component-log是本地開發的一個日志包,2個項目需要同時使用
2.不想上傳到私有倉儲,同時要求使用Jenkins發布
3.采用方案:引用本地Jar包打包

二、解決辦法

1.加scope和systempath

注意加在最外層pom(由於項目結構復雜,開始沒有放最外層,踩了很多坑都沒有發布成功)
<dependency>
<groupId>com.xxx</groupId>
<artifactId>xxx-component-log</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}/../../lib/xxx-component-log-1.0-SNAPSHOT.jar
</systemPath>
</dependency>

 

 

2.在最外層的pom添加includeSystemScope和repackage

 
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.0.0.RELEASE</version>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

 


免責聲明!

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



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