Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plugin org.apache.maven.plugins:maven-compiler-plugin or one of its dependencies could not be resolved

I'm having some issues to configure properly my eclipse to work with maven.

I create a new project, this one is correctly build with maven in command line (mvn install), but in Eclipse I got this error:

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 for org.apache.maven.plugins:maven-compiler-plugin:jar:3.1 (): ArtifactDescriptorException: Failed to read artifact descriptor for org.apache.maven:maven-settings:jar:2.2.1: ArtifactResolutionException: Failure to transfer org.apache.maven:maven-settings:pom:2.2.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:maven-settings:pom:2.2.1 from/to central : NullPointerException pom.xml /test line 9 Maven Project Build Lifecycle Mapping Problem

Here is my settings.xml conf :

<proxy>
  <active>true</active>
  <protocol>http</protocol>
  <username>myuser</username>
  <password>$mymdp</password>
  <host>myhost</host>
  <port>8080</port>
  <nonProxyHosts>some.host.com</nonProxyHosts>
</proxy>
....

<repository>
     <id>central</id>
     <name>central repo m2</name>
     <url>http://central.maven.org/maven2</url>
</repository>

I choose the correct maven installation (in Preference -> Maven -> Install)

I also direct my user settings on the correct settings.xml (Preferences -> Maven -> User Settings)

But I still got this error in Eclipse and everything goes well with maven command line. Do you have and idea?

like image 264
user3275313 Avatar asked Feb 05 '14 13:02

user3275313


People also ask

What is Maven compiler plugin in POM XML?

The compiler plugin is used to compile the source code of a Maven project. This plugin has two goals, which are already bound to specific phases of the default lifecycle: compile – compile main source files. testCompile – compile test source files.

What is Apache Maven plugin?

Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information.


2 Answers

Have you tried to remove the proxy username and password? A similar poster encountered that issue:

Could not calculate build plan: Plugin org.apache.maven.plugins:maven-jar-plugin:2.3.2 or one of its dependencies could not be resolved

Failing that I found the following worked:

  1. Delete project in Eclipse (but do not delete the contents on disk)
  2. Delete all files in your Maven repository
  3. Re-download all Maven dependencies:

mvn dependency:resolve

  1. Start up Eclipse
  2. Ensure that Eclipse is configured to use your external Maven installation (Window->Preferences->Maven->Installations)
  3. Re-import the existing project(s) into Eclipse
  4. Ensure that there are no Maven Eclipse plugin errors on the final screen of the project import
like image 114
Conor Svensson Avatar answered Oct 21 '22 01:10

Conor Svensson


You only need to delete one folder it is throwing error for. Just go to your M2 repo and org/apache/maven/plugins/maven-compiler-plugins and delete the folder 2.3.2

like image 40
Mahaveer Jangir Avatar answered Oct 21 '22 00:10

Mahaveer Jangir