[英]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:尝试以下步骤:
Make sure you have connectivity (you can browse) (This kind of error is usually due to connectivity with Internet)确保你有连接(你可以浏览)(这种错误通常是由于与互联网的连接)
Download Maven and unzip it下载Maven并解压
Create a JAVA_HOME
System Variable创建JAVA_HOME
系统变量
Create an M2_HOME
System Variable创建M2_HOME
系统变量
Add %JAVA_HOME%\\bin;%M2_HOME%\\bin;
添加%JAVA_HOME%\\bin;%M2_HOME%\\bin;
to your PATH
variable到您的PATH
变量
Open a command window cmd
.打开命令窗口cmd
。 Check: mvn -v
检查: mvn -v
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
Make sure you have .m2/repository
(erase all the folders and files below)确保您有.m2/repository
(删除下面的所有文件夹和文件)
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 :尝试以下操作:
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
变量。
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 存储库或使用代理。
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,如下所示:
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.