简体   繁体   中英

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.

I've tried to create a Maven Project, yet it always returns four errors:

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

The other two (one for default-compile and the other for default-testCompile) have a structure like this:

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 )

My Maven installation seems to be functional because running mvn -version returns:

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. Any help?

It turns out that I didn't have the most up-to-date version of M2E. So to solve this, I uninstalled all versions of M2E that came with Eclipse. Then I followed the instructions on http://download.eclipse.org/technology/m2e/releases

However, I had previously just added that exact URL to Eclipse's Install New Software dialogue. What you have to do instead is click the link to Show Directory Contents and select the version of M2E you wish to use. In this case, it was 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. The URL in this case was 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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