maven java错误,标记重复:“配置”

fnvucqvd  于 2021-08-25  发布在  Java
关注(0)|答案(1)|浏览(664)

我在maven身上犯了个错误。它在vs代码中添加了一个与工具的依赖项,并关闭了签入样式。我试图重新启动vs代码,因为它可能是一个bug,但显然不是。调试错误消息:

[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

下面是pom.xml文件

qvk1mo1f

qvk1mo1f1#

如果您查看错误,它会显示第80行有问题。对于插件 maven-checkstyle-plugin 你有两个 configuration xml中的标记。我会把它改成一个:

<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>

相关问题