eclipse (pom.xml) 中的 Maven 错误:无法传输 org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4

新手上路,请多包涵

我想使用 Maven 创建 Web 项目以自动导入我需要的所有库,所以我选择了 "maven-archetype-webpp"

之后我在 pom.xml 文件中收到此错误:

 Description Resource Path Location Type Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 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.plugins:maven-surefire-plugin:pom:2.12.4 from/to central (http://repo.maven.apache.org/maven2): The operation was cancelled. pom.xml /SpringTuto line 1 Maven Configuration Problem

我已经更新了我的 Maven 项目,但没有结果!!

POM.XML:

 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.pre.example</groupId>
  <artifactId>SpringTuto</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>SpringTuto Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <finalName>SpringTuto</finalName>
  </build>
</project>

原文由 AHmedRef 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 677
1 个回答

您只需按照以下步骤操作:

  1. 右键单击您的项目:Run (As) -> Maven clean
  2. 右键单击您的项目:Run (As) -> Maven install

之后,如果在Maven Install 时构建失败,则说明WEB-INF 下没有web.xml 文件或相关问题。真的行

原文由 Mohamed NAOUALI 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题