failed with MalformedInputException: Input length = 1 when building java application with maven 3.9.0

huangapple go评论125阅读模式
英文:

failed with MalformedInputException: Input length = 1 when building java application with maven 3.9.0

问题

Java应用程序在使用Maven 3.6.0-3.8.x构建时完全正常。然而,使用Maven 3.9.0构建时,对于HTML或XML文件出现了这个奇怪的错误。

在项目{project_name}上执行org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources(默认资源)目标失败:将{path1}/30168019.html过滤为{path2}/30168019.html时出现MalformedInputException:输入长度=1 -> [帮助 1]

起初,我认为可能与Maven的编码问题有关,但在POM文件中已经指定了UTF-8。是否有人知道是什么导致了这个错误?

英文:

The java application is building perfectly fine with maven 3.6.0-3.8.x . However with maven 3.9.0 it is giving this strange error for html or xml files.

Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources (default-resources) on project {project_name}: filtering {path1}/30168019.html to {path2}/30168019.html failed with MalformedInputException: Input length = 1 -> [Help 1]

First I thought might be some encoding issue wrt maven but in the pom file it is mentioned utf-8 itself. Does anyobody have any idea what might be causing this error?

答案1

得分: 1

我通过将以下插件添加到我的pom.xml中来解决了这个问题:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <version>3.1.0</version>
</plugin>

这只是一个临时解决方法,正确的解决方法是确保你的文件正确编码。更多细节在此选定答案中:https://stackoverflow.com/questions/65910112/maven-clean-install-failed-to-execute-goal-org-apache-maven-pluginsmaven-resou

英文:

I had this issue and fixed it by adding the below plugin to my pom.xml:

&lt;plugin&gt;
    &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
    &lt;artifactId&gt;maven-resources-plugin&lt;/artifactId&gt;
    &lt;version&gt;3.1.0&lt;/version&gt;
&lt;/plugin&gt;

This is a workaround, and the proper fix is to make sure your files are properly encoded. More details in the selected answer here: https://stackoverflow.com/questions/65910112/maven-clean-install-failed-to-execute-goal-org-apache-maven-pluginsmaven-resou

huangapple
  • 本文由 发表于 2023年3月9日 17:44:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/75682819.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定