无法计算构建计划:插件org.apache. plugins:maven-resources-plugin:2.6或者它的一个依赖项不能被解决

时间:2022-02-18 14:08:22

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——版本命令,它工作得很好。但是重新启动我的电脑并检查了Maven之后,它就可以正常工作了。然后说:

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

6 个解决方案

#1


9  

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; to your PATH variable

    添加% JAVA_HOME % \ bin;% M2_HOME % \ bin。你的路径变量

  6. Open a command window cmd. Check: mvn -v

    打开命令窗口cmd。检查: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/储存库(删除下面所有文件夹和文件)

  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插件-设置。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

#2


4  

Delete all files under the .m2 repository folder and rebuild the project.

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

#3


1  

Try the following :

试试以下:

  1. Make sure you add M2_HOME variable to your environment variables. It looks like you might have set M2_HOME temporarily in a cmd window and not as a permanent environment variable. Also append M2_HOME to the PATH variable.

    确保将M2_HOME变量添加到环境变量中。看起来您可能暂时在cmd窗口中设置了M2_HOME,而不是将其作为永久环境变量。还将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. Look for the settings.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.

    例子:在Windows上,对于用户机器人,将面临C:\Users\bot. .m2目录寻找的设置。此目录中的xml文件,并在此文件中查找存储库url。看看你是否能够从浏览器点击这个url。如果没有,您可能需要指向不同的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. This can be found by navigating to org.apache.maven.plugins folder in the browser. 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. This can be fixed by changing the depndency version to the one available in the repository.

    如果您能够从浏览器中访问存储库url,那么请检查存储库是否包含maven-resource-plugin 2.6版本。这可以通过导航到org.apache.maven找到。浏览器中的插件文件夹。您的pom可能已经将插件的依赖性硬编码为2.6,但在存储库中不可用。可以通过将深度查询版本更改为存储库中可用的版本来修复这一点。

#4


1  

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
  2. 在Eclipse中选择“帮助/安装新软件”打开“安装”对话框。
  3. Insert following link into "Work with:" input box http://download.eclipse.org/technology/m2e/releases/
    and press Enter
  4. 将以下链接插入“Work with:”输入框http://download.eclipse.org/technology/m2e/releases/并按Enter
  5. Select (check) "Maven Integration for Eclipse" and choose "Next >" button
  6. 选择(检查)“Maven集成Eclipse”并选择“Next >”按钮。
  7. Continue with the installation, confirm the License agreement, let the installation download what is necessary
  8. 继续安装,确认许可协议,让安装下载什么是必要的
  9. After successful installation you should restart Eclipse
  10. 安装成功后,应该重新启动Eclipse
  11. Your project should be loaded without Maven-related errors now
  12. 现在,您的项目应该在没有出现与maven相关的错误的情况下被加载

#5


0  

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 -复制设置路径。xml从用户设置-用户设置-切换到新的工作空间-更新首选项- Maven -用户设置-用户设置-用户设置路径

After the build is completed, all errors are resolved.

构建完成后,所有错误都得到解决。

#6


0  

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 sts and deleted the old .m2 repository from the system and created a new maven project in sts which downloaded the complete .m2 repository. It worked for me.

我在spring tool suite(sts)遇到了类似的问题。.m2存储库没有完全在本地系统中下载,这就是为什么我得到这个错误的原因。因此,我重新安装了sts并从系统中删除了旧的.m2存储库,并在sts中创建了一个新的maven项目,该项目下载了完整的.m2存储库。它为我工作。

#1


9  

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; to your PATH variable

    添加% JAVA_HOME % \ bin;% M2_HOME % \ bin。你的路径变量

  6. Open a command window cmd. Check: mvn -v

    打开命令窗口cmd。检查: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/储存库(删除下面所有文件夹和文件)

  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插件-设置。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

#2


4  

Delete all files under the .m2 repository folder and rebuild the project.

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

#3


1  

Try the following :

试试以下:

  1. Make sure you add M2_HOME variable to your environment variables. It looks like you might have set M2_HOME temporarily in a cmd window and not as a permanent environment variable. Also append M2_HOME to the PATH variable.

    确保将M2_HOME变量添加到环境变量中。看起来您可能暂时在cmd窗口中设置了M2_HOME,而不是将其作为永久环境变量。还将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. Look for the settings.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.

    例子:在Windows上,对于用户机器人,将面临C:\Users\bot. .m2目录寻找的设置。此目录中的xml文件,并在此文件中查找存储库url。看看你是否能够从浏览器点击这个url。如果没有,您可能需要指向不同的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. This can be found by navigating to org.apache.maven.plugins folder in the browser. 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. This can be fixed by changing the depndency version to the one available in the repository.

    如果您能够从浏览器中访问存储库url,那么请检查存储库是否包含maven-resource-plugin 2.6版本。这可以通过导航到org.apache.maven找到。浏览器中的插件文件夹。您的pom可能已经将插件的依赖性硬编码为2.6,但在存储库中不可用。可以通过将深度查询版本更改为存储库中可用的版本来修复这一点。

#4


1  

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
  2. 在Eclipse中选择“帮助/安装新软件”打开“安装”对话框。
  3. Insert following link into "Work with:" input box http://download.eclipse.org/technology/m2e/releases/
    and press Enter
  4. 将以下链接插入“Work with:”输入框http://download.eclipse.org/technology/m2e/releases/并按Enter
  5. Select (check) "Maven Integration for Eclipse" and choose "Next >" button
  6. 选择(检查)“Maven集成Eclipse”并选择“Next >”按钮。
  7. Continue with the installation, confirm the License agreement, let the installation download what is necessary
  8. 继续安装,确认许可协议,让安装下载什么是必要的
  9. After successful installation you should restart Eclipse
  10. 安装成功后,应该重新启动Eclipse
  11. Your project should be loaded without Maven-related errors now
  12. 现在,您的项目应该在没有出现与maven相关的错误的情况下被加载

#5


0  

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 -复制设置路径。xml从用户设置-用户设置-切换到新的工作空间-更新首选项- Maven -用户设置-用户设置-用户设置路径

After the build is completed, all errors are resolved.

构建完成后,所有错误都得到解决。

#6


0  

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 sts and deleted the old .m2 repository from the system and created a new maven project in sts which downloaded the complete .m2 repository. It worked for me.

我在spring tool suite(sts)遇到了类似的问题。.m2存储库没有完全在本地系统中下载,这就是为什么我得到这个错误的原因。因此,我重新安装了sts并从系统中删除了旧的.m2存储库,并在sts中创建了一个新的maven项目,该项目下载了完整的.m2存储库。它为我工作。