【问题标题】:Maven Java Error with Duplicated tag: 'configuration'带有重复标签的 Maven Java 错误:“配置”
【发布时间】:2021-07-07 20:51:24
【问题描述】:

我在使用 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

这里是pom.xml file

【问题讨论】:

    标签: java maven visual-studio-code


    【解决方案1】:

    如果您查看错误,则表明第 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>
    

    【讨论】:

    • 没问题@pmalys - 如果您能接受答案,将不胜感激。
    猜你喜欢
    • 1970-01-01
    • 2013-07-12
    • 1970-01-01
    • 2013-02-13
    • 2012-05-26
    • 1970-01-01
    • 1970-01-01
    • 2015-10-10
    • 1970-01-01
    相关资源
    最近更新 更多