Eclipse为maven编译阶段抛出错误?

时间:2015-11-11 09:53:09

标签: pom.xml

项目无法执行maven生命周期映射的两个生命周期阶段:

  1. 编译器:编译
  2. 编译器:testcompile
  3. 以下是eclipse中的错误:

    1.   

      CoreException:无法计算构建计划:插件   org.apache.maven.plugins:maven-compiler-plugin:2.5.1或其中一个   无法解析依赖项:无法读取工件描述符   for org.apache.maven.plugins:maven-compiler-plugin:jar:2.5.1:   ArtifactResolutionException:无法传输   org.apache.maven.plugins:maven-compiler-plugin:pom:2.5.1 from   http://repo.maven.apache.org/maven2被缓存在当地   存储库,在更新之前不会重新尝试解析   中心间隔已经过去或强制更新。原始错误:   无法转移神器   org.apache.maven.plugins:maven-compiler-plugin:pom:2.5.1 from / to   central(http://repo.maven.apache.org/maven2):repo.maven.apache.org
        pom.xml / ex line 1 Maven Project Build   生命周期映射问题

    2.   

      生命周期配置未涵盖插件执行:   org.apache.maven.plugins:Maven的编译器插件:2.5.1:编译   (执行:default-compile,phase:compile)pom.xml
        / ex line 1 Maven Project构建生命周期映射问题

    3.   

      生命周期配置未涵盖插件执行:   org.apache.maven.plugins:Maven的编译器插件:2.5.1:testCompile   (执行:default-testCompile,阶段:test-compile)
        pom.xml / ex line 1 Maven Project   构建生命周期映射问题

2 个答案:

答案 0 :(得分:4)

在eclipse goto windows-> preferences-> maven->用户设置

将用户设置文本框指向%M2_HOME%\ conf

中的setting.xml

答案 1 :(得分:0)

if its not working still then you need to add plugins in the POM.xml and update project

<build>
    <plugins>
        <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.20</version>
                <configuration>
                     <suiteXmlFiles>
                            <suiteXmlFile>testng.xml</suiteXmlFile>
                     </suiteXmlFiles>
                </configuration>
             </plugin>
             <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.6.2</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
        </configuration>
        </plugin>
    </plugins>
</build>