我已经安装了Maven 3.3.9,我正在使用JDK 1.8.0_65运行Eclipse Mars 2.
我试图创建一个Maven项目,但它总是返回四个错误:
Description Resource Path Location Type
CoreException: Could not get the value for parameter compilerId for plugin execution default-compile: PluginResolutionException: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be resolved: Failed to collect dependencies at org.apache.maven.plugins:maven-compiler-plugin:jar:3.1 -> org.codehaus.plexus:plexus-container-default:jar:1.5.5 -> org.apache.xbean:xbean-reflect:jar:3.4 -> log4j:log4j:jar:1.2.12: ArtifactDescriptorException: Failed to read artifact descriptor for log4j:log4j:jar:1.2.12: ArtifactResolutionException: Failure to transfer log4j:log4j:pom:1.2.12 from https://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 log4j:log4j:pom:1.2.12 from/to central (https://repo.maven.apache.org/maven2): The operation was cancelled. pom.xml /PluginBasedPasswords line 1 Maven Project Build Lifecycle Mapping Problem
我得到了与上面相似的错误但插件执行default-testCompile
另外两个(一个用于default-compile,另一个用于default-testCompile)具有如下结构:
Description Resource Path Location Type
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (execution: default-compile, phase: compile) pom.xml /PluginBasedPasswords line 1 Maven Project Build Lifecycle Mapping Problem
项目创建向导向我显示了类似的版本:
我已经按照几个教程安装了Maven并设置我的环境变量,所以我怀疑它们是否属实(如果需要:路径:C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Maven\apache-maven-3.3.9\bin;;C:\Program Files\Java\jdk1.8.0_65\bin;C:\Program Files\Java\jre1.8.0_73;
,M2_HOME:C:\Program Files\Maven\apache-maven-3.3.9
和JAVA_HOME:C:\Program Files\Java\jdk1.8.0_65
)
我的Maven安装似乎正常运行,因为运行mvn -version
会返回:
C:\Windows\system32>mvn -version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T16:41:4
7+00:00)
Maven home: C:\Program Files\Maven\apache-maven-3.3.9
Java version: 1.8.0_65, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_65\jre
Default locale: en_GB, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"
我还通过Esclipse Marketplace更新了我的M2E插件,所以我真的不知道出了什么问题。有什么帮助吗?
答案 0 :(得分:4)
事实证明,我没有最新版本的M2E。因此,为了解决这个问题,我卸载了Eclipse附带的所有M2E版本。然后我按照http://download.eclipse.org/technology/m2e/releases
上的说明进行操作但是,我之前刚刚在Eclipse的Install New Software对话框中添加了确切的URL。您需要做的是单击指向显示目录内容的链接,然后选择您要使用的M2E版本。在这种情况下,它是1.6。然后选择最新的子版本。
完成后,从浏览器中复制新URL并将其添加到安装软件对话框中。此案例中的网址为http://download.eclipse.org/technology/m2e/releases/1.6/1.6.2.20150902-0002/?d。一旦完成,一切都突然起作用了!
希望在我的情况下帮助过某人。