很多情况下,一些jar包在maven上面那是没有对应的引用依赖。所以只能引用本地的jar文件。但是这种情况下不能直接引用,添加到referenceLibrary中的,
1,需要在项目的目录下添加libs目录.

2,在pom文件中添加如下配置,来让maven知道这个jar文件是本地的
2 3 4 5 6 7 8 9 10 11 12 13 14 | < dependency >
< groupId >com.aliyun</ groupId >
< artifactId >aliyun-java-sdk-core</ artifactId >
< version >3.2.2</ version >
< scope >system</ scope >
< systemPath >${project.basedir}/libs/aliyun-java-sdk-core-3.3.1.jar</ systemPath >
</ dependency >
< dependency >
< groupId >com.aliyun</ groupId >
< artifactId >aliyun-java-sdk-dysmsapi</ artifactId >
< version >1.0.0</ version >
< scope >system</ scope >
< systemPath >${project.basedir}/libs/aliyun-java-sdk-dysmsapi-1.0.0.jar</ systemPath >
</ dependency >
3,在pom中给spring boot打包的插件设置一下 includeSystemScope参数即可
< build >
< plugins >
< plugin >
< groupId >org.springframework.boot</ groupId >
< artifactId >spring-boot-maven-plugin</ artifactId >
< configuration >
< includeSystemScope >true</ includeSystemScope >
</ configuration >
</ plugin >
</ plugins >
</ build >
经过以上三步,一个maven的Spring boot的项目就可以把本地的jar打包进自己的war包里。
本文转载自: https://www.jb51.net/article/130449.htm
|