org.apache.maven.plugins目标执行失败

时间:2012-07-02 16:34:19

标签: maven maven-plugin

我正在尝试使用maven生成war文件但是我收到此错误(大部分下载日志输出被省略以使日志更清晰):

Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-war-plugin/2.1.1/maven-war-plugin-2.1.1.pom
Downloaded: 
...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building tn.talan.selenium Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ tn.talan.selenium ---
...
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ tn.talan.selenium ---
...
[INFO] --- maven-war-plugin:2.1.1:war (default-cli) @ tn.talan.selenium ---
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/maven-archiver/2.4.1/maven-archiver-2.4.1.pom
Downloaded: 
...
[INFO] BUILD FAILURE
...
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-cli) on project tn.talan.selenium: Execution default-cli of goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war failed: Plugin org.apache.maven.plugins:maven-war-plugin:2.1.1 or one of its dependencies could not be resolved: Could not transfer artifact org.codehaus.plexus:plexus-io:jar:1.0.1 from/to central (http://repo.maven.apache.org/maven2): GET request of: org/codehaus/plexus/plexus-io/1.0.1/plexus-io-1.0.1.jar from central failed: Read timed out -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
...

这是我的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>selenium</groupId>
  <artifactId>tn.talan.selenium</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>tn.talan.selenium 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>tn.talan.selenium</finalName>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>tomcat-maven-plugin</artifactId>
        <version>1.0-beta-1</version>
      </plugin>

    </plugins>

  </build>

</project>

我的pom有什么问题?好吗?

2 个答案:

答案 0 :(得分:17)

指定maven-war-plugin的版本,例如

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-war-plugin</artifactId>
  <version>2.2</version>
</plugin>

答案 1 :(得分:-1)

为了解决这个错误,你不需要做任何事情,只需改变你的jdk版本。您可以选择任何 jdk 版本,但不要选择最新版本。尝试使用旧版本。推荐:JDK 11.0.11