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
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:
C:\Users\User Name>mvn --version
'mvn' is not recognized as an internal or external command,
operable program or batch file.
Try the following :
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.
Go to the m2
folder in your user directory.
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.
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.
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.
Delete all files under the .m2 repository folder and rebuild the project.
Try update your Eclipse with the newest Maven repository as follows:
Step1: Delete all instances of java from you machine
Step2: Delete all the environment variables related to java/jdk/jre
Step3: Check in programm files and program files(X86) folder, there should not be java folder.
Step4: Install java again.
Step5: Go to cmd and type "java -version" Result: it will display the java version which is installed in your machine.
Step6: now delete all the files which are in C:/User/AdminOrUserNameofYourMachine/.m2 folder
Step6: go to cmd and run "mvn -v" Result: It will display the Apache maven version installed on your machine
Step7: Now Rebuild your project.
This worked for me.
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
After the build is completed, all errors are resolved.
Source: Stackoverflow.com