Java 插件 org.apache.maven.plugins:maven-compiler-plugin 或其依赖项之一无法解析
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21579247/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Plugin org.apache.maven.plugins:maven-compiler-plugin or one of its dependencies could not be resolved
提问by user3275313
I'm having some issues to configure properly my eclipse to work with maven.
我在正确配置我的 eclipse 以使用 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:
我创建了一个新项目,这个项目是在命令行 ( mvn install
) 中使用 maven 正确构建的,但是在 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/maven2was 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
CoreException:无法获取插件执行默认编译的参数 compilerId 的值:PluginResolutionException:插件 org.apache.maven.plugins:maven-compiler-plugin:3.1 或其依赖项之一无法解析:无法收集依赖项org.apache.maven.plugins:maven-compiler-plugin:jar:3.1 (): ArtifactDescriptorException: 无法读取 org.apache.maven:maven-settings:jar:2.2.1: ArtifactResolutionException: 无法传输组织的工件描述符.apache.maven:maven-settings:pom:2.2.1 来自http://repo.maven.apache.org/maven2已缓存在本地存储库中,直到 Central 的更新间隔已过或强制更新,才会重新尝试解析。原始错误:无法传输工件 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 :
这是我的 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)
我选择了正确的 maven 安装(在 Preference -> Maven -> Install)
I also direct my user settings on the correct settings.xml (Preferences -> Maven -> User Settings)
我还将我的用户设置指向正确的 settings.xml(首选项 -> Maven -> 用户设置)
But I still got this error in Eclipse and everything goes well with maven command line. Do you have and idea?
但是我在 Eclipse 中仍然遇到此错误,并且 maven 命令行一切正常。你有没有想法?
采纳答案by Conor Svensson
Have you tried to remove the proxy username and password? A similar poster encountered that issue:
您是否尝试删除代理用户名和密码?一个类似的海报遇到了这个问题:
无法计算构建计划:插件 org.apache.maven.plugins:maven-jar-plugin:2.3.2 或其依赖项之一无法解析
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:
- 在 Eclipse 中删除项目(但不要删除磁盘上的内容)
- 删除 Maven 存储库中的所有文件
- 重新下载所有 Maven 依赖项:
mvn dependency:resolve
mvn 依赖:解决
- 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
- 启动 Eclipse
- 确保 Eclipse 配置为使用您的外部 Maven 安装(Window->Preferences->Maven->Installations)
- 将现有项目重新导入 Eclipse
- 确保项目导入的最终屏幕上没有 Maven Eclipse 插件错误
回答by Fizal Haji
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.
当 Maven 设置的安装在 Eclipse 中作为外部提供时,该问题已得到解决。导航设置为窗口 --> 首选项 --> 安装。选择外部作为安装类型,提供安装主页和名称,然后单击完成。最后选择这个作为默认安装。
回答by Mahaveer Jangir
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
您只需要删除一个引发错误的文件夹。只需转到您的 M2 存储库和 org/apache/maven/plugins/maven-compiler-plugins 并删除文件夹 2.3.2
回答by Garet Jax
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.
我在构建全新的开发机器时使用 IBM RSA 9.6.1 时遇到了这个问题。我的问题最终是因为 Global Maven 存储库上的 HTTPS。我的解决方案是创建一个强制它使用 HTTP 的 Maven settings.xml。
The key to me was that the central repository was empty when I exploded it under Maven Repositories -- > Global Repositories
对我来说,关键是当我在 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>