Maven打包字体损坏解决

young 580 2021-10-17

场景:字体打包时损坏,导致生成PDF时报错
字体损坏.png
在pom.xml的build标签中添加如下插件,使相关文件不被编译

<plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-resources-plugin</artifactId>
     <version>2.7</version>
         <configuration>
             <nonFilteredFileExtensions>
                 <nonFilteredFileExtension>ttf</nonFilteredFileExtension>
                 <nonFilteredFileExtension>ftl</nonFilteredFileExtension>
                 <nonFilteredFileExtension>html</nonFilteredFileExtension>
             </nonFilteredFileExtensions>
         </configuration>
         <dependencies>
             <dependency>
                 <groupId>org.apache.maven.shared</groupId>
                 <artifactId>maven-filtering</artifactId>
                 <version>1.3</version>
             </dependency>
         </dependencies>
</plugin>