Spring Boot - Font Awesome OTS parsing error: Failed to convert 字體加載失敗
阿新 • • 發佈:2018-01-31
quest error: pid extension 圖片 sta rec fault filter
字體文件,加載不出來
解決方案 一
問題是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找到解決方案
Spring Boot - Font Awesome OTS parsing error: Failed to convert 字體加載失敗