java - 带有重复标签的 Maven Java 错误:“配置”
问题描述
我在使用 Maven 时遇到错误。它在 VS Code 中使用该工具添加了一个依赖项,并在 . 我试图重新启动 vs 代码,因为它可能是一个错误,但显然不是。 调试错误消息:
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-parseable POM c:\Users\wikim\Desktop\Java\argbot\pom.xml: Duplicated tag: 'configuration' (position: START_TAG seen ...</dependencies>\r\n <configuration>... @80:24) @ line 80, column 24
@
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project (c:\Users\wikim\Desktop\Java\argbot\pom.xml) has 1 error
[ERROR] Non-parseable POM c:\Users\wikim\Desktop\Java\argbot\pom.xml: Duplicated tag: 'configuration' (position: START_TAG seen ...</dependencies>\r\n <configuration>... @80:24) @ line 80, column 24 -> [Help 2]
[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/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/ModelParseException
解决方案
如果您查看错误,则显示第 80 行有问题。对于插件maven-checkstyle-plugin
,您在 XML 中有两个configuration
标签。我会将其更改为单个:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven-checkstyle-plugin.version}</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<configLocation>com/github/ngeor/checkstyle.xml</configLocation>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<skip>${skipTests}</skip>
</configuration>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>${checkstyle.version}</version>
</dependency>
<dependency>
<groupId>com.github.ngeor</groupId>
<artifactId>checkstyle-rules</artifactId>
<version>${checkstyle-rules.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>checkstyle</id>
<phase>none</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
推荐阅读
- elasticsearch - 使用 Lambda 与带有 CloudWatch 订阅过滤器的 Firehose 发布到 ElasticSearch
- java - StackOverflowError - 这怎么可能?
- python - 类型对象不可下标 - python
- hadoop - 基于文件结构的 Hive 表创建
- laravel - 当您将调试设置为 false 时,如何在 Lumen 中隐藏 .env 密码?
- javascript - 路径上的渐变:路径转换时悬停
- php - 找不到 PHP 类控制器
- php - Codeigniter - 如何内部加入?
- reporting-services - Dynamics 365 ssrs 创建多个报表
- hyperlink - 标头的降价链接