简体   繁体   English

无法计算构建计划:插件 org.apache.maven.plugins:maven-resources-plugin: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

When I am try to build the project it gives this error.当我尝试构建项目时,它会出现此错误。

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

My Java version is 1.8 and Maven version is 3.2.5我的 Java 版本是 1.8,Maven 版本是 3.2.5

And also when I first time configure Maven in my computer and I check that Maven configured correctly with mvn --version command and it works fine.而且,当我第一次在我的计算机中配置 Maven 时,我检查 Maven 是否使用mvn --version命令正确配置并且它工作正常。 But after restart my computer and checked Maven is work correctly.但是在重新启动我的计算机并检查 Maven 后是否正常工作。 Then it says:然后它说:

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

Try the following steps:尝试以下步骤:

  1. Make sure you have connectivity (you can browse) (This kind of error is usually due to connectivity with Internet)确保你有连接(你可以浏览)(这种错误通常是由于与互联网的连接)

  2. Download Maven and unzip it下载Maven并解压

  3. Create a JAVA_HOME System Variable创建JAVA_HOME系统变量

  4. Create an M2_HOME System Variable创建M2_HOME系统变量

  5. Add %JAVA_HOME%\\bin;%M2_HOME%\\bin;添加%JAVA_HOME%\\bin;%M2_HOME%\\bin; to your PATH variable到您的PATH变量

  6. Open a command window cmd .打开命令窗口cmd Check: mvn -v检查: mvn -v

  7. If you have a proxy, you will need to configure it如果您有代理,则需要对其进行配置

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

  1. Make sure you have .m2/repository (erase all the folders and files below)确保您有.m2/repository (删除下面的所有文件夹和文件)

  2. If you are going to use Eclipse, You will need to create the settings.xml如果您打算使用 Eclipse,您将需要创建settings.xml

Maven plugin in Eclipse - Settings.xml file is missing Eclipse 中的 Maven 插件 - Settings.xml 文件丢失

You can see more detail in您可以在

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

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

Try the following :尝试以下操作:

  1. Make sure you add M2_HOME variable to your environment variables.确保将M2_HOME变量添加到环境变量中。 It looks like you might have set M2_HOME temporarily in a cmd window and not as a permanent environment variable.看起来您可能在cmd窗口中临时设置了M2_HOME而不是永久环境变量。 Also append M2_HOME to the PATH variable. M2_HOME附加到PATH变量。

  2. Go to the m2 folder in your user directory.转到用户目录中的m2文件夹。

    Example: On Windows, for user bot , the .m2 directory will be under C:\\Users\\bot .示例:在 Windows 上,对于用户bot.m2目录将位于C:\\Users\\bot Look for the settings.xml file in this directory and look for the repository url within this file.在此目录中查找settings.xml文件并在此文件中查找存储库 URL。 See if you are able to hit this url from your browser.看看您是否可以从浏览器中访问此 url。 If not, you probably need to point to a different maven repository or use a proxy.如果没有,您可能需要指向不同的 Maven 存储库或使用代理。

  3. If you are able to hit the repository url from the browser, then check if the repository contains the maven-resource-plugin version 2.6.如果您能够从浏览器访问存储库 url,请检查存储库是否包含maven-resource-plugin版本 2.6。 This can be found by navigating to org.apache.maven.plugins folder in the browser.这可以通过导航到浏览器中的org.apache.maven.plugins文件夹找到。 It's possible that your pom has hard-coded the dependency of the plugin to 2.6 but it is not available in the repository.您的pom可能已将插件的依赖项硬编码为 2.6,但它在存储库中不可用。 This can be fixed by changing the depndency version to the one available in the repository.这可以通过将依赖版本更改为存储库中可用的版本来解决。

Try update your Eclipse with the newest Maven repository as follows:尝试使用最新的 Maven 存储库更新您的 Eclipse,如下所示:

  1. Open "Install" dialog box by choosing "Help/Install New Software..." in Eclipse通过在 Eclipse 中选择“帮助/安装新软件...”打开“安装”对话框
  2. Insert following link into "Work with:" input box http://download.eclipse.org/technology/m2e/releases/将以下链接插入“Work with:”输入框http://download.eclipse.org/technology/m2e/releases/
    and press Enter然后按 Enter
  3. Select (check) "Maven Integration for Eclipse" and choose "Next >" button选择(选中)“Maven Integration for Eclipse”并选择“Next >”按钮
  4. Continue with the installation, confirm the License agreement, let the installation download what is necessary继续安装,确认许可协议,让安装下载需要的东西
  5. After successful installation you should restart Eclipse安装成功后,您应该重新启动 Eclipse
  6. Your project should be loaded without Maven-related errors now您的项目现在应该在没有与 Maven 相关的错误的情况下加载

This helped me: I created a new maven project which was working fine in my old workspace, but gave above errors in the new workspace.这对我有帮助:我创建了一个新的 maven 项目,该项目在我的旧工作区中运行良好,但在新工作区中出现了上述错误。 I had to do the following: - Open old workspace on Eclipse - open Preferences tab - Search Maven in filter - Copy the path for settings.xml from User Settings - User Settings - Switch to new workspace - Update the preferences - Maven - User Settings - User Settings path我必须执行以下操作: - 在 Eclipse 上打开旧工作区 - 打开首选项选项卡 - 在过滤器中搜索 Maven - 从用户设置复制 settings.xml 的路径 - 用户设置 - 切换到新工作区 - 更新首选项 - Maven - 用户设置- 用户设置路径

After the build is completed, all errors are resolved.构建完成后,所有错误都解决了。

I had a similar problem in spring tool suite(sts) .我在spring 工具套件(sts)中遇到了类似的问题。 THE .m2 repository was not completely downloaded in the local system which is the reason why I was getting this error. .m2 存储库未完全下载到本地系统中,这就是我收到此错误的原因。 So I reinstalled sts and deleted the old .m2 repository from the system and created a new maven project in sts which downloaded the complete .m2 repository.所以我重新安装了sts并从系统中删除了旧的 .m2 存储库,并在sts 中创建了一个新的maven项目,该项目下载了完整的 .m2 存储库。 It worked for me.它对我有用。

Step1: Delete all instances of java from you machine步骤 1:从您的机器中删除所有 java 实例

Step2: Delete all the environment variables related to java/jdk/jre Step2:删除所有与java/jdk/jre相关的环境变量

Step3: Check in programm files and program files(X86) folder, there should not be java folder. Step3:检查programm files和program files(X86)文件夹,应该没有java文件夹。

Step4: Install java again. Step4:再次安装java。

Step5: Go to cmd and type "java -version" Result: it will display the java version which is installed in your machine.第五步:进入 cmd 并输入“java -version” 结果:它将显示您机器中安装的 java 版本。

Step6: now delete all the files which are in C:/User/AdminOrUserNameofYourMachine/.m2 folder步骤 6:现在删除 C:/User/AdminOrUserNameofYourMachine/.m2 文件夹中的所有文件

Step6: go to cmd and run "mvn -v" Result: It will display the Apache maven version installed on your machine Step6:进入cmd并运行“mvn -v” 结果:它会显示你机器上安装的Apache maven版本

Step7: Now Rebuild your project.第七步:现在重建你的项目。

This worked for me.这对我有用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法计算构建计划:插件 org.apache.maven.plugins:maven-resources-plugin:2.5 或其依赖项之一无法解析 - Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved 插件 org.apache.maven.plugins:maven-resources-plugin:2.6 或其依赖项之一无法解析 - Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved 在新的 Maven 项目上:无法计算构建计划:插件 org.apache.maven.plugins:maven-resources-plugin:2.6? - on new Maven Project: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6? 无法更新 Maven 配置无法计算构建计划:插件 org.apache.maven.plugins:maven-resources-plugin:2.5 - Unable to update Maven configuration Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 CoreException:无法计算构建计划:插件 org.apache.maven.plugins:maven-compiler-plugin:2.5.1 或其依赖项之一 - CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.5.1 or one of its dependencies 插件 org.apache.maven.plugins:maven-compiler-plugin 或其依赖项之一无法解析 - Plugin org.apache.maven.plugins:maven-compiler-plugin or one of its dependencies could not be resolved 插件 org.apache.maven.plugins:maven-install-plugin:2.4 或其依赖项之一无法解析 - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved Maven:插件 org.apache.maven.plugins:maven-clean-plugin:2.5 或其依赖项之一无法解析 - Maven : Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved 无法计算构建计划:插件 org.apache.maven.plugins:maven-war-plugin:2.2 - Could not calculate build plan: Plugin org.apache.maven.plugins:maven-war-plugin:2.2 Maven构建失败并显示错误消息Plugin org.apache.maven.plugins:maven-surefire-plugin:2.12.4或其依赖项之一无法解析 - Maven build fails with error message Plugin org.apache.maven.plugins:maven-surefire-plugin:2.12.4 or one of its dependencies could not be resolved
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM