錯誤描述
SpringBoot專案的maven專案參考字體庫font報錯,字體font圖示不能顯示
Failed to decode downloaded font,OTS parsing error錯誤問題

頁面顯示:

錯誤原因
經過maven的filter,會破壞font檔案的二進制檔案格式,到時前臺決議出錯,
SpringBoot專案,通常會使用properties檔案或yml檔案保存配置資訊,專案啟動時,需要maven開啟filtering用properties(或yml)中的屬性值替換掉組態檔中的占位符
解決方案:不過濾這些font字體檔案
<!-- 引入字體檔案報錯:Failed to decode downloaded font,OTS parsing error -->
<!-- 經過maven的filter,會破壞font檔案的二進制檔案格式,到時前臺決議出錯, -->
<!-- 配置不過濾這些font字體檔案 -->
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<excludes>
<exclude>static/plugins/font-awesome/fonts/**</exclude>
</excludes>
<includes>
<include>**</include>
</includes>
</resource>
</resources>
</build>
這時候再運行,字體檔案就加載正常了

轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/235435.html
標籤:其他
