第一种方式: 解决maven打包时,会编译特定文件导致文件不可用
maven打包时,过滤不编译文件类型。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>xlsx</nonFilteredFileExtension>
<nonFilteredFileExtension>xls</nonFilteredFileExtension>
<nonFilteredFileExtension>zip</nonFilteredFileExtension>
<nonFilteredFileExtension>cer</nonFilteredFileExtension>
<nonFilteredFileExtension>pfx</nonFilteredFileExtension>
<nonFilteredFileExtension>py</nonFilteredFileExtension>
<nonFilteredFileExtension>keystore</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
第二种方式:在过滤的时候排除掉相应的文件。
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>static/fonts/**</exclude>
<exclude>static/file/**</exclude>
</excludes>
</resource>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>static/fonts/**</include>
<include>static/file/**</include>
</includes>
</resource>