简体   繁体   English

Eclipse中的M2E给出了maven-compiler-plugin错误,但Maven安装很好

[英]M2E in Eclipse gives maven-compiler-plugin errors, but Maven installation is fine

I've installed Maven 3.3.9 and I'm running Eclipse Mars 2 with JDK 1.8.0_65. 我已经安装了Maven 3.3.9,我正在使用JDK 1.8.0_65运行Eclipse Mars 2。

I've tried to create a Maven Project, yet it always returns four errors: 我试图创建一个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

I get a similar error to the one above but for plugin execution default-testCompile 我得到了类似的错误,但是对于插件执行default-testCompile

The other two (one for default-compile and the other for default-testCompile) have a structure like this: 另外两个(一个用于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

The project creation wizard shows me a similar version: 项目创建向导向我显示了一个类似的版本:

导入Maven项目GUI显示我收到的错误。

I've followed several tutorials for installing Maven and setting my environment variables so I doubt it is them (if needed: PATH: 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 and JAVA_HOME: C:\\Program Files\\Java\\jdk1.8.0_65 ) 我已经按照几个教程来安装Maven并设置我的环境变量,所以我怀疑它们是否存在(如果需要:PATH: 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

My Maven installation seems to be functional because running mvn -version returns: 我的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"

I've also updated my M2E plugin via the Esclipse Marketplace so I truly have no idea what's going wrong. 我还通过Esclipse Marketplace更新了我的M2E插件,所以我真的不知道出了什么问题。 Any help? 有帮助吗?

It turns out that I didn't have the most up-to-date version of M2E. 事实证明,我没有最新版本的M2E。 So to solve this, I uninstalled all versions of M2E that came with Eclipse. 因此,为了解决这个问题,我卸载了Eclipse附带的所有M2E版本。 Then I followed the instructions on http://download.eclipse.org/technology/m2e/releases 然后我按照http://download.eclipse.org/technology/m2e/releases上的说明进行操作

However, I had previously just added that exact URL to Eclipse's Install New Software dialogue. 但是,我之前刚刚在Eclipse的Install New Software对话框中添加了确切的URL。 What you have to do instead is click the link to Show Directory Contents and select the version of M2E you wish to use. 您需要做的是单击显示目录内容的链接,然后选择您要使用的M2E版本。 In this case, it was 1.6. 在这种情况下,它是1.6。 Then you select the most recent sub-version. 然后选择最新的子版本。

Once done, copy the new URL from your browser and add it to the install software dialogue. 完成后,从浏览器中复制新URL并将其添加到安装软件对话框中。 The URL in this case was http://download.eclipse.org/technology/m2e/releases/1.6/1.6.2.20150902-0002/?d . 本案例中的URL为http://download.eclipse.org/technology/m2e/releases/1.6/1.6.2.20150902-0002/?d Once this was done, everything suddenly worked! 一旦完成,一切都突然起作用了!

Hope that has helped someone in my situation. 希望在我的情况下帮助了某些人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM