字体文件,加载不出来
解决方案 一
问题是Maven正在过滤字体文件并破坏它们。
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<filtering>true</filtering>
</resource>
解决的办法是做出以下更改 pom.xml
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>static/fonts/**</exclude>
</excludes>
</resource>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>static/fonts/**</include>
</includes>
</resource>
此更改允许在打包期间不会过滤字体。
解决方案二
另一种方法是更新maven-resources-plugin的配置,如下所示:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>ttf</nonFilteredFileExtension>
<nonFilteredFileExtension>woff</nonFilteredFileExtension>
<nonFilteredFileExtension>woff2</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
本文章参考https://stackoverflow.com/questions/34037051/spring-boot-font-awesome-ots-parsing-error-failed-to-convert
国内找老半天找不到,终于在stackoverflow找到解决方案