2015-12-02 36 views
7

Spring Boot/Spring MVCアプリケーション内でフォントが正しく動作しない問題が発生しました。Spring Boot - フォントAwesome OTSの解析エラー:変換に失敗しました

問題は、フォントファイルのすべてがこのような

Failed to decode downloaded font: http://localhost:8080/fonts/fontawesome-webfont.woff2?v=4.4.0 
OTS parsing error: Failed to convert WOFF 2.0 font to SFNT 

Failed to decode downloaded font: http://localhost:8080/fonts/fontawesome-webfont.woff?v=4.4.0 
OTS parsing error: incorrect file size in WOFF header 

Failed to decode downloaded font: http://localhost:8080/fonts/fontawesome-webfont.ttf?v=4.4.0 
OTS parsing error: incorrect entrySelector for table directory 

答えて

22

以下のように様々なエラーを表示し、問題が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> 

に次の変更を作ることでした。

0

たぶんあなたのファイルapplication.propertiesは次のようにそれを行うための別の方法は、Mavenの-リソース - プラグインの設定の更新です

security.ignored=/css/**,/js/**,/images/**,/font/** 
+1

わかりませんMavenに影響を与えます。 Mavenはこの問題を紹介したものでした。 – code

0

のようないくつかのパスを無視する必要があります。これらの設定

<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> 
関連する問題