我在正确配置 eclipse 以使用 maven 时遇到了一些问题。
我创建了一个新项目,这个项目是在命令行中使用 maven 正确构建的(mvn install
),但是在 Eclipse 中我得到了这个错误:
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
这是我的 settings.xml 配置文件:
<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>
我选择了正确的 maven 安装(在 Preference -> Maven -> Install 中)
我还将我的用户设置指向正确的 settings.xml(首选项 -> Maven -> 用户设置)
但我在 Eclipse 中仍然遇到此错误,并且使用 maven 命令行一切正常。你有想法吗?
最佳答案
您只需删除一个出现错误的文件夹。只需转到您的 M2 存储库和 org/apache/maven/plugins/maven-compiler-plugins 并删除文件夹 2.3.2
关于java - 插件 org.apache.maven.plugins :maven-compiler-plugin or one of its dependencies could not be resolved,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21579247/