公司springboot web项目使用maven构建,模块a为启动入口,依赖模块b。
模块b中因为使用了一些第三方的jar包,在官方仓库找不到,公司没有私服。有以下两种解决方式。
1、将包发布到自己本地电脑的Maven仓库,正常依赖即可。
2、
(1)在模块b的pom中添加本地依赖
<dependency>
<groupId>com.taobao</groupId>
<artifactId>taobao-sdk</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/../lib/taobao-sdk-java-auto_1502853394064-20180105.jar</systemPath>
</dependency>
(2)在模块a的pom中添加拷贝资源
<resources>
<resource>
<directory>../lib</directory>
<targetPath>BOOT-INF/lib/</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
<!-- 某些情况下,打包后运行不起来需要打开注释 -->
<!--<resource>-->
<!--<directory>src/main/resources</directory>-->
<!--<targetPath>BOOT-INF/classes/</targetPath>-->
<!--</resource>-->
</resources>
(3)在模块a和b的parent目录下添加lib文件夹,将需要加的包放进去
(4)模块b不要添加spingboot-maven-plugin、maven-compile、打包资源等等描述