在项目的在pom文件中引入如下
<resources>
<resource>
<directory>src/main/java</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.*</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<excludes>
<exclude>ApplicationTest.class</exclude>
<exclude>**/*Test*.class</exclude>
<exclude>**/static/**</exclude>
<exclude>**/**/*.yaml</exclude>
</excludes>
</configuration>
</plugin>
</plugins>