问题
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?
回答1:
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:
- Delete project in Eclipse (but do not delete the contents on disk)
- Delete all files in your Maven repository
- Re-download all Maven dependencies:
mvn dependency:resolve
- Start up Eclipse
- Ensure that Eclipse is configured to use your external Maven installation (Window->Preferences->Maven->Installations)
- Re-import the existing project(s) into Eclipse
- Ensure that there are no Maven Eclipse plugin errors on the final screen of the project import
回答2:
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
回答3:
I was getting this problem when using IBM RSA 9.6.1 when building a brand new development machine. The problem for me ended up being because of HTTPS on the Global Maven repository. My solution was to create a Maven settings.xml that forced it to use HTTP.
The key to me was that the central repository was empty when I exploded it under Maven Repositories -- > Global Repositories
Using the following settings file worked for me:
<settings>
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>insecurecentral</activeProfile>
</activeProfiles>
<profiles>
<profile>
<id>insecurecentral</id>
<!--Override the repository (and pluginRepository) "central" from the Maven Super POM -->
<repositories>
<repository>
<id>central</id>
<url>http://repo.maven.apache.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://repo.maven.apache.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>
I got the idea from this stackoverflow question.
回答4:
The issue has been resolved while installation of the maven settings is provided as External in Eclipse. The navigation settings are Window --> Preferences --> Installations. Select the External as installation Type, provide the Installation home and name and click on Finish. Finally select this as default installations.
来源:https://stackoverflow.com/questions/21579247/plugin-org-apache-maven-pluginsmaven-compiler-plugin-or-one-of-its-dependencies