Eclipse 在 Maven 编译阶段抛出错误?
Eclipse throwing errors for maven compile phase?
项目无法执行 Maven 生命周期映射的两个生命周期阶段:
- 编译器:编译
- 编译器:测试编译
以下是 eclipse 中的错误:
CoreException: Could not calculate build plan: Plugin
org.apache.maven.plugins:maven-compiler-plugin:2.5.1 or one of its
dependencies could not be resolved: Failed to read artifact descriptor
for org.apache.maven.plugins:maven-compiler-plugin:jar:2.5.1:
ArtifactResolutionException: Failure to transfer
org.apache.maven.plugins:maven-compiler-plugin:pom:2.5.1 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-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
Lifecycle Mapping Problem
Plugin execution not covered by lifecycle configuration:
org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile
(execution: default-compile, phase: compile) pom.xml
/ex line 1 Maven Project Build Lifecycle Mapping Problem
Plugin execution not covered by lifecycle configuration:
org.apache.maven.plugins:maven-compiler-plugin:2.5.1:testCompile
(execution: default-testCompile, phase: test-compile)
pom.xml /ex line 1 Maven Project
Build Lifecycle Mapping Problem
在eclipse中转到windows->preferences->maven->user setting
将用户设置文本框指向 %M2_HOME%\conf
中的 setting.xml
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>
项目无法执行 Maven 生命周期映射的两个生命周期阶段:
- 编译器:编译
- 编译器:测试编译
以下是 eclipse 中的错误:
CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.5.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:2.5.1: ArtifactResolutionException: Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:2.5.1 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-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 Lifecycle Mapping ProblemPlugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (execution: default-compile, phase: compile) pom.xml
/ex line 1 Maven Project Build Lifecycle Mapping ProblemPlugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.5.1:testCompile (execution: default-testCompile, phase: test-compile)
pom.xml /ex line 1 Maven Project Build Lifecycle Mapping Problem
在eclipse中转到windows->preferences->maven->user setting
将用户设置文本框指向 %M2_HOME%\conf
中的 setting.xmlif 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>