目录
问题一:直接打包时system中指定systemPath文件未打包进去
问题一:直接打包时system中指定systemPath文件未打包进去
1) 打包为jar包时,需要加入如下配置
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<!-- 如果为多个模块,引入模块中包含system时,加入此配置 -->
<goal>repackage</goal>
</goals>
</execution>
</executions>
<!-- jar包中引入system系统路径jar包,此配置必须 -->
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
2)打包为war包时,需要加入如下配置
<!-- 设置maven-war-plugins插件,覆盖默认配置 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<resource>
<!-- 指定项目资源目录 -->
<directory>lib</directory>
<!-- 指定资源的目标目录路径 -->
<targetPath>WEB-INF/lib/</targetPath>
<!-- 包含-过滤 -->
<includes>
<include>**/*.jar</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
3)springboot引入当前模块system外部jar到包中(不包含模块中外部jar)
<!-- springboot resource配置 -->
<resources>
<!-- 配置将目录directory过滤内容打包到目标目录路径 -->
<resource>
<!-- 指定目录 -->
<directory>lib</directory>
<targetPath>BOOT-INF/lib/</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
<!-- 不配置resources时默认时已有此配置,由于自定义覆盖默认,需重新定义 -->
<resource>
<directory>src/main/resources</directory>
<targetPath>BOOT-INF/classes/</targetPath>
</resource>
</resources>
问题二:打包时如何跳过测试
1)配置插件跳过
<!-- 跳过单元测试 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
2)全局配置方式
<properties>
<!-- 跳过测试 -->
<skipTests>true</skipTests>
</properties>
end