maven 打包时报错:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.3.1:resources (default-resources) on project ec-work-mes: filtering /Users/ecmaster/svn/ecmaster/ynmk/ynmk-mes/ec-work/ec-work-mes/src/main/resources/reports/fonts/msyh.ttf to /Users/ecmaster/svn/ecmaster/ynmk/ynmk-mes/ec-work/ec-work-mes/target/classes/reports/fonts/msyh.ttf failed with MalformedInputException: Input length = 1 -> [Help 1]
看不到详细信息, 加-e查看详细报错
mvn install -e
Caused by: java.nio.charset.MalformedInputException: Input length = 1
我这里是 Maven 在资源处理(filter)过程中错误地尝试对二进制文件进行文本编码处理导致的。修改pom.xml 排除二进制文件即可
<resources>
<resource>
<directory>src/main/resources</directory>
<!--开启过滤,用指定的参数替换directory下的文件中的参数-->
<filtering>true</filtering>
<excludes>
<exclude>**/*.ttf</exclude>
<exclude>**/*.jasper </exclude>
</excludes>
</resource>
</resources>
还有可能是配置文件的编码格式不正确导致的
在IDEA-Setting-Editor-File Encodings中配置编码格式为utf-8