Java 无法计算构建计划:插件 org.apache.maven.plugins:maven-resources-plugin:2.6 或其依赖项之一无法解析
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28145877/
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
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved
提问by NoughT
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.
But after restart my computer and checked Maven is work correctly.
Then it says:
而且当我第一次在我的计算机中配置 Maven 时,我检查了 Maven 是否使用mvn --version
命令正确配置并且工作正常。但是在重新启动我的计算机并检查 Maven 后是否正常工作。然后它说:
C:\Users\User Name>mvn --version
'mvn' is not recognized as an internal or external command,
operable program or batch file.
采纳答案by Fernando Castilla
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
Create a
JAVA_HOME
System VariableCreate an
M2_HOME
System VariableAdd
%JAVA_HOME%\bin;%M2_HOME%\bin;
to yourPATH
variableOpen a command window
cmd
. Check:mvn -v
If you have a proxy, you will need to configure it
确保您有连接(您可以浏览)(这种错误通常是由于与 Internet 连接)
下载Maven并解压
创建
JAVA_HOME
系统变量创建
M2_HOME
系统变量添加
%JAVA_HOME%\bin;%M2_HOME%\bin;
到您的PATH
变量打开命令窗口
cmd
。查看:mvn -v
如果您有代理,则需要对其进行配置
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)If you are going to use Eclipse, You will need to create the
settings.xml
确保你有
.m2/repository
(擦除下面的所有文件夹和文件)如果您打算使用 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
回答by CKing
Try the following :
尝试以下操作:
Make sure you add
M2_HOME
variable to your environment variables. It looks like you might have setM2_HOME
temporarily in acmd
window and not as a permanent environment variable. Also appendM2_HOME
to thePATH
variable.Go to the
m2
folder in your user directory.Example: On Windows, for user
bot
, the.m2
directory will be underC:\Users\bot
. Look for thesettings.xml
file in this directory and look for the repository url within this file. See if you are able to hit this url from your browser. If not, you probably need to point to a different maven repository or use a proxy.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. This can be found by navigating toorg.apache.maven.plugins
folder in the browser. It's possible that yourpom
has hard-coded the dependency of the plugin to 2.6 but it is not available in the repository. This can be fixed by changing the depndency version to the one available in the repository.
确保将
M2_HOME
变量添加到环境变量中。看起来您可能已经M2_HOME
在cmd
窗口中临时设置而不是作为永久环境变量。还附加M2_HOME
到PATH
变量。转到
m2
用户目录中的文件夹。示例:在 Windows 上,对于 user
bot
,.m2
目录将在C:\Users\bot
.settings.xml
在此目录中查找文件并在此文件中查找存储库 url。看看您是否可以从浏览器中访问此 url。如果没有,您可能需要指向不同的 Maven 存储库或使用代理。如果您能够从浏览器访问存储库 url,请检查存储库是否包含
maven-resource-plugin
2.6 版。这可以通过导航到org.apache.maven.plugins
浏览器中的文件夹找到。您可能pom
已将插件的依赖项硬编码为 2.6,但它在存储库中不可用。这可以通过将依赖版本更改为存储库中可用的版本来解决。
回答by user4311047
Try update your Eclipse with the newest Maven repository as follows:
尝试使用最新的 Maven 存储库更新您的 Eclipse,如下所示:
- Open "Install" dialog box by choosing "Help/Install New Software..." in Eclipse
- Insert following link into "Work with:" input box
http://download.eclipse.org/technology/m2e/releases/
and press Enter - Select (check) "Maven Integration for Eclipse" and choose "Next >" button
- Continue with the installation, confirm the License agreement, let the installation download what is necessary
- After successful installation you should restart Eclipse
- Your project should be loaded without Maven-related errors now
- 通过在 Eclipse 中选择“帮助/安装新软件...”打开“安装”对话框
- 将以下链接插入“Work with:”输入框
http://download.eclipse.org/technology/m2e/releases/
并按 Enter - 选择(选中)“Maven Integration for Eclipse”并选择“Next >”按钮
- 继续安装,确认许可协议,让安装下载需要的东西
- 安装成功后,您应该重新启动 Eclipse
- 您的项目现在应该在没有与 Maven 相关的错误的情况下加载
回答by Andrés Rosales Campos
Delete all files under the .m2 repository folder and rebuild the project.
删除 .m2 存储库文件夹下的所有文件并重建项目。
回答by Srikanth Hampapur
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. 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
这对我有帮助:我创建了一个新的 maven 项目,该项目在我的旧工作区中运行良好,但在新工作区中出现了上述错误。我必须执行以下操作: - 在 Eclipse 上打开旧工作区 - 打开首选项选项卡 - 在过滤器中搜索 Maven - 从用户设置复制 settings.xml 的路径 - 用户设置 - 切换到新工作区 - 更新首选项 - Maven - 用户设置- 用户设置路径
After the build is completed, all errors are resolved.
构建完成后,所有错误都解决了。
回答by Anirudh
I had a similar problem in spring tool suite(sts). THE .m2 repository was not completely downloaded in the local system which is the reason why I was getting this error. So I reinstalled stsand deleted the old .m2 repository from the system and created a new mavenproject in stswhich downloaded the complete .m2 repository. It worked for me.
我在spring 工具套件(sts)中遇到了类似的问题。.m2 存储库未完全下载到本地系统中,这就是我收到此错误的原因。所以我重新安装了sts并从系统中删除了旧的 .m2 存储库,并在sts 中创建了一个新的maven项目,该项目下载了完整的 .m2 存储库。它对我有用。
回答by Deepika Mittal
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.
这对我有用。