【问题标题】:Error in pom.xml Maven buildpom.xml Maven 构建中的错误
【发布时间】:2023-03-26 01:45:01
【问题描述】:

尝试构建 maven 项目时,我的 pom.xml 中出现错误。这个插件的错误在这里:

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
      </plugin>

这是 Eclipse 显示的错误:

Multiple annotations found at this line:
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:
 2.3.2:compile (execution: default-compile, phase: compile)
- CoreException: Could not get the value for parameter compilerId for plugin execution default-compile: 
 PluginResolutionException: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.2 or one of its dependencies could not 
 be resolved: Failed to collect dependencies for org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2 (): 
 ArtifactDescriptorException: Failed to read artifact descriptor for org.apache.maven:maven-toolchain:jar:1.0: 
 ArtifactResolutionException: Failure to transfer org.apache.maven:maven-toolchain:pom:1.0 from http://repo.maven.apache.org/
 maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or 
 updates are forced. Original error: Could not transfer artifact org.apache.maven:maven-toolchain:pom:1.0 from/to central (http://
 repo.maven.apache.org/maven2): The operation was cancelled.

【问题讨论】:

  • 问题取决于传输失败者Failure to transfer org.apache.maven:maven-toolchain:pom:1.0 from http://repo.maven.apache.org/。您在通过代理或类似的东西时遇到问题。首先解决您的连接问题。之后,只需删除本地存储库的内容。

标签: eclipse maven m2eclipse


【解决方案1】:

好像解决失败了。

使用 -U 标志运行 mvn 以忽略缓存并重新尝试解析

(alt+f5 对话框也可能有帮助)

【讨论】:

    【解决方案2】:

    当我遇到这个问题时,我发现这是由于之前的网络问题造成的。本地 Maven 存储库可避免立即重新尝试。解决此问题的最佳方法是使用 eclipse 的“更新 Maven 项目”(ALT+F5) 功能结束检查选项“强制更新快照/发布”。

    【讨论】:

      【解决方案3】:

      这对我不起作用,将 maven 编译器版本更改为 2.5.1 终于对我有用,希望这对仍在与这种依赖作斗争的人有所帮助

      <build>
           <pluginManagement>
              <plugins>
                      <plugin>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-compiler-plugin</artifactId>
                          <version>2.5.1</version>
                          <configuration>
                              <source>1.8</source>
                              <target>1.8</target>
                          </configuration>
                      </plugin>
              </plugins>
              </pluginManagement>
          </build>
      

      【讨论】:

        【解决方案4】:

        按 (ALT+F5) 更新 Maven 项目并选择“强制更新快照/发布”选项。

        【讨论】:

          【解决方案5】:

          按 (ALT+F5) 更新 Maven 项目并选择“强制更新快照/发布”选项。也适合我

          【讨论】:

            【解决方案6】:

            遇到类似问题。 Maven 更新和强制更新快照对我不起作用。

            执行以下步骤,问题已解决:

            1. 在 Eclipse 中删除项目。
            2. 删除 .Project 文件和 .设置文件夹。
            3. 将项目作为现有的maven项目再次导入eclipse。

            【讨论】:

              猜你喜欢
              • 1970-01-01
              • 2017-06-28
              • 2017-06-26
              • 2012-01-10
              • 2015-06-20
              • 2013-11-24
              • 2016-10-03
              • 2014-04-04
              • 2016-07-03
              相关资源
              最近更新 更多