无法计算构建计划:无法解析 Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 或其依赖项之一

2022-09-04 02:09:32

当我尝试构建项目时,它会给出此错误。

Errors occurred during the build.
Errors running builder 'Maven Project Builder' on project 'ProjectName'.
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6

我的Java版本是1.8,Maven版本是3.2.5

而且,当我第一次在我的计算机中配置Maven时,我检查Maven是否正确配置了命令,它工作正常。但是在重新启动计算机并检查Maven是否正常工作后。然后它说:mvn --version

C:\Users\User Name>mvn --version
'mvn' is not recognized as an internal or external command,
operable program or batch file.

答案 1

请尝试以下步骤:

  1. 确保您已建立连接(可以浏览)(此类错误通常是由于与 Internet 的连接造成的)

  2. 下载 Maven 并解压缩它

  3. 创建系统变量JAVA_HOME

  4. 创建系统变量M2_HOME

  5. 添加到变量%JAVA_HOME%\bin;%M2_HOME%\bin;PATH

  6. 打开命令窗口 。检查:cmdmvn -v

  7. 如果您有代理,则需要对其进行配置

http://maven.apache.org/guides/mini/guide-proxies.html

  1. 确保你有(删除下面的所有文件夹和文件).m2/repository

  2. 如果您要使用 Eclipse,则需要创建settings.xml

Eclipse 中的 Maven 插件 - 设置.xml文件丢失

您可以在

http://maven.apache.org/ref/3.2.5/maven-settings/settings.html


答案 2

删除 .m2 存储库文件夹下的所有文件并重新生成项目。


推荐