Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources和如何修改idea的默认编码
2023-09-14 09:07:25 时间
今天使用idea创建完一新项目后,将其他项目的application.properties文件里的数据拷贝到当前项目的application.properties中。
执行mvn -clean
没事有问题,但执行mvn install
便出现如下错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources) on project superjsonmanager: Input length = 1 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
参考网上的资料,需要在pom.xml文件中添加如下代码:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-filtering</artifactId>
<version>3.2.0</version>
</dependency>
</dependencies>
</plugin>
添加以上代码后,依旧报错,于是再次去看错误信息。
根据错误提示信息可以看出,让我们使用UT-8的编码格式,于是,去查询idea如何设置编码格式,即file -> settings -> editor -> file editor -> file encodings ,查看原格式是什么?
从图中可以看到,idea默认编码格式为GBK,因而,我们拷贝过来的数据出现了编码格式的错误,于是,按照如下方式修改即可:
。
修改完成后,重新启动项目,还是报出上诉的错误,查找原因后知道,原来修改完编码后,application.properties文件出现了乱码:
于是修改乱码:
修改之后,重新执行 mvn -celan
和mvn -install
,便能正常install了,如图所示:
相关文章
- Eclipse创建maven的war工程没有web.xml解决方式
- Maven继承
- 自定义maven变量以及maven内置常量
- 【idea异常】idea中下载maven源码报错:Caused by: java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
- 手把手教你搭建Maven项目
- maven中如何打包源代码
- apache maven pom setting
- 上传Android或Java库到Maven central repository(转载)
- Maven - 在CentOS7.5安装Maven
- maven-dependency-plugin(goals copy-dependencies unpack ) is not supported by m2e
- Maven 编码相关问题
- Java SSM1——Maven
- Maven基础知识--Maven资源库详述
- Maven 项目 无缘无故报错:版本冲突,其他机器上正常-提交的时候报冲突怎么也解决不掉
- 【异常】Maven提示错误The expression ${artifactId} is deprecated. Please use ${project.artifactId} instead.
- maven项目转成web项目没有生成WebContent目录