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