springboot maven plugins resources 打包后导致字体失效解决办法

tech2024-05-22  80

问题:

 最近在开发项目的时候,设置springboot profile多环境打包时,页面加载不出来font包下图标

解决:

 

<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <configuration> <!-- 使用默认的变量标记方法即${*} --> <useDefaultDelimiters>true</useDefaultDelimiters> <nonFilteredFileExtensions> <nonFilteredFileExtension>woff</nonFilteredFileExtension> <nonFilteredFileExtension>woff2</nonFilteredFileExtension> <nonFilteredFileExtension>eot</nonFilteredFileExtension> <nonFilteredFileExtension>ttf</nonFilteredFileExtension> <nonFilteredFileExtension>svg</nonFilteredFileExtension> </nonFilteredFileExtensions> </configuration> </plugin> <resource> <filtering>true</filtering> <directory>src/main/resources</directory> <excludes> <exclude>**/*.woff</exclude> <exclude>**/*.ttf</exclude> <exclude>**/*.eot</exclude> <exclude>**/*.svg</exclude> </excludes> </resource>

需要在pom文件中添加这两个配置

最新回复(0)