Maven error : Could not calculate build plan - java

I am getting the following errors and i do not know why. I have set up my project on multiple environments and Ive never had any issue but recently i have added the project to an environment running Windows 8 with everything set up correctly (e.g. Maven... ) and i seem to be getting this issue
Multiple annotations found at this line:
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (execution: default-compile, phase: compile)
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.5.1:testCompile (execution: default-testCompile, phase: test-compile)
- CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.5.1 or one of its dependencies could not be resolved: Failed to read
artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:2.5.1: ArtifactResolutionException: Could not transfer artifact org.apache.maven.plugins:maven-compiler-
plugin:pom:2.5.1 from/to central (http://repo.maven.apache.org/maven2): Address family not supported by protocol family: connect
- CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.5.1 or one of its dependencies could not be resolved: Failed to read
artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:2.5.1: ArtifactResolutionException: Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:2.5.1
from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced.
Original error: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:2.5.1 from/to central (http://repo.maven.apache.org/maven2): Address family not supported
by protocol family: connect
and
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
I have looked at this online and have tried numerous different things listed below to try and resolve this issue but none of them seem to work. Just to note i am not using any proxies
Delete .m2 repository, Maven -> Update Project...
Delete all .lastUpdated files, Maven -> Update Project...
Tried selecting "Force Update of Snapshots/Releases" when updating project
Does anyone have any other ideas on what i could try?

In Eclipse, go to Windows > Preferences > Maven > User Settings
In User Settings, fill in the field with the path to settings.xml > %M2_HOME%\conf (or the correct path).

it seems like that your project doesn't install the dependency needed.
Therefore you need to install it yourself.
Download both jar and pom files from the Maven Repository and installing it using the command (better than copying to the folder directly)
mvn install:install-file -Dfile=<path-to-file> -DpomFile=<path-to-pomfile>
and also be sure that you have installed all the necessary repository for the project and cross verify in the .m2/repository folder with the jar files

I had similar error while setting up my project on new VM:
"CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.5.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:2.5.1: ArtifactResolutionException: Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:2.5.1 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:2.5.1 from/to central (http://repo.maven.apache.org/maven2): connect timed out..."
Cause and Fix for this in my case :
I have apache-maven-3.2.5 installed on the system but found that
settings.xml file is missing in .M2 folder under my user name ( C:\Users\MyUserName.m2) hence above error on building the project
Steps to fix:
Step 1: Copy settings.xml from C:\Users\Public.m2 to .m2 folder under my username on the VM ( C:\Users\MyUserName.m2)
Step2: Using CMD run a clean install after navigating to the project to see if issue is fixed and project builds without error
like this :
C:\Selenium_Test_SetupB\WebUatDemo>mvn clean install

Related

Error "No plugin found for prefix 'archetype' in the current project and in the plugin groups" getting in creating new java maven project

I am trying to create a new java maven project in Netbeans 8.2 . I am following the below steps:
Logs:
Scanning for projects...
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom
Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-clean-plugin:2.4.1: Plugin org.apache.maven.plugins:maven-clean-plugin:2.4.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.3.1/maven-install-plugin-2.3.1.pom
Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-install-plugin:2.3.1: Plugin org.apache.maven.plugins:maven-install-plugin:2.3.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-install-plugin:jar:2.3.1
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-deploy-plugin/2.7/maven-deploy-plugin-2.7.pom
Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-deploy-plugin:2.7: Plugin org.apache.maven.plugins:maven-deploy-plugin:2.7 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-deploy-plugin:jar:2.7
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-site-plugin/3.0/maven-site-plugin-3.0.pom
Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-site-plugin:3.0: Plugin org.apache.maven.plugins:maven-site-plugin:3.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-site-plugin:jar:3.0
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-antrun-plugin/1.3/maven-antrun-plugin-1.3.pom
Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-antrun-plugin:1.3: Plugin org.apache.maven.plugins:maven-antrun-plugin:1.3 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-antrun-plugin:jar:1.3
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-assembly-plugin/2.2-beta-5/maven-assembly-plugin-2.2-beta-5.pom
Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5: Plugin org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-assembly-plugin:jar:2.2-beta-5
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-dependency-plugin/2.1/maven-dependency-plugin-2.1.pom
Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-dependency-plugin:2.1: Plugin org.apache.maven.plugins:maven-dependency-plugin:2.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-dependency-plugin:jar:2.1
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-release-plugin/2.0/maven-release-plugin-2.0.pom
Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-release-plugin:2.0: Plugin org.apache.maven.plugins:maven-release-plugin:2.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-release-plugin:jar:2.0
Downloading: http://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml
Could not transfer metadata org.apache.maven.plugins/maven-metadata.xml from/to central (http://repo.maven.apache.org/maven2): Failed to transfer file: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml. Return code is: 501 , ReasonPhrase:HTTPS Required.
Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to central (http://repo.maven.apache.org/maven2): Failed to transfer file: http://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml. Return code is: 501 , ReasonPhrase:HTTPS Required.
Failure to transfer org.apache.maven.plugins/maven-metadata.xml from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer metadata org.apache.maven.plugins/maven-metadata.xml from/to central (http://repo.maven.apache.org/maven2): Failed to transfer file: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml. Return code is: 501 , ReasonPhrase:HTTPS Required.
Failure to transfer org.codehaus.mojo/maven-metadata.xml from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to central (http://repo.maven.apache.org/maven2): Failed to transfer file: http://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml. Return code is: 501 , ReasonPhrase:HTTPS Required.
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 4.914s
Finished at: Sat Feb 08 10:44:37 BDT 2020
Final Memory: 7M/119M
But I am getting this error.
No plugin found for prefix 'archetype' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/home/sultan/.m2/repository), central (http://repo.maven.apache.org/maven2)] -> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException
same issue I got, and similarly on Netbeans 8.2:
Within the Netbeans installation, this settings update worked for me:
Goto Netbeans installation folder > java > maven > conf
for me it was C:\Program Files\NetBeans 8.2\java\maven\conf, and here I updated the settings.xml file using administrative privilege.
as http repo link will not work now, just I created an valid https mirror for central repo that is pre-built with IDE which cannot be changed.
Add this inside mirrors tag of settings.xml
<mirror>
<id>mirror1</id>
<mirrorOf>central</mirrorOf>
<name>mirror1</name>
<url>https://repo.maven.apache.org/maven2/</url>
</mirror>
after this restart Netbeans IDE, and central repository will be overridden with the mirror we specified https://repo.maven.apache.org/maven2/.
The part of output says ReasonPhrase:HTTPS Required, so therefore it cannot make proper request to the http endpoint.
Try changing the URLs to the maven central repository in your maven settings.
The globals are in: ${maven.home}/conf/settings.xml
And user settings in: ${user.home}/.m2/settings.xml
There's possibility that you're using maven which comes with Netbeans installation, then you'd need to search for that setting file in netbeans installation folder. Try going to Tools/Options/Maven on netbeans interface - there should be info about the location currently used maven directory.
Search the repo.maven.apache.org/maven2 (or the whole URL from your logs) through those files and change the http to https.
Just to add, the error contains the http://repo.maven.apache.org/maven2 URL - prehaps you can search for it in that settings.xml files and change http to https.
Take a look at this two questions for more info:
Can not find where maven local repository path in netbeans 8.0.2 is set
Change Maven repository that NetBeans uses
For other info, go through short description in:
https://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException
I had the same problem. My path and java_home was set to open jdk. Switching to oracle jdk fixed it.

Could not calculate build plan at the creation of a maven project

I just created a new maven project, at the creation, I already have an error :
Description Resource Path Location Type
CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2: ArtifactResolutionException: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:2.3.2 from/to central (http://repo.maven.apache.org/maven2): null to http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/2.3.2/maven-compiler-plugin-2.3.2.pom pom.xml /WD_Automation line 1 Maven Project Build Lifecycle Mapping Problem
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (execution: default-compile, phase: compile) pom.xml /WD_Automation line 1 Maven Project Build Lifecycle Mapping Problem
CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2: ArtifactResolutionException: Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:2.3.2 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:2.3.2 from/to central (http://repo.maven.apache.org/maven2): null to http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/2.3.2/maven-compiler-plugin-2.3.2.pom pom.xml /WD_Automation line 1 Maven Project Build Lifecycle Mapping Problem
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.3.2:testCompile (execution: default-testCompile, phase: test-compile) pom.xml /WD_Automation line 1 Maven Project Build Lifecycle Mapping Problem
I don't understand why because I haven't touch anything in the pom or anything else.
Do you have an idea ?
Maven tries to download plugins from MavenCentral, but fails. This is usually a network or proxy problem.
From the error message, maybe this repository http://repo.maven.apache.org/maven2 is unreached for you, you can search for a usable repositroy on the internet.
I replaced Eclipse Kepler 4.3.2 SR2 with java8 patches with Eclipse Photon 4.8.0, and the problem has gone.

Maven Could not calculate build plan: Plugin org.apache.maven.plugins:maven-war-plugin:2.2 or one of its dependencies could not be resolved

New to maven and ubuntu. Maven version is 3.0.5. First i imported a maven project into eclipse and there were lot of maven dependency error. So i did maven clean install from pom.xml location using terminal and subsequent mvn install command from terminal build was successful. But if I import the project again and update project into eclipse I see 5 errors.
Maven configuration Problem:
Description Resource Path Location Type
Failure to transfer org.apache.maven.plugins:maven-war-plugin:pom:2.2 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-war-plugin:pom:2.2 from/to central (https://repo.maven.apache.org/maven2): connect timed out pom.xml /loga line"
Maven Problem
Description Resource Path Location Type
CoreException: Could not get the value for parameter compilerId for plugin execution default-compile: PluginResolutionException: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.3 or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.apache.maven:maven-plugin-api:jar:2.2.1, org.apache.maven:maven-artifact:jar:2.2.1, org.apache.maven:maven-core:jar:2.2.1, org.apache.maven:maven-settings:jar:2.2.1, org.apache.maven:maven-plugin-parameter-documenter:jar:2.2.1, org.apache.maven:maven-profile:jar:2.2.1, org.apache.maven:maven-model:jar:2.2.1, org.apache.maven:maven-repository-metadata:jar:2.2.1, org.apache.maven:maven-error-diagnostics:jar:2.2.1, org.apache.maven:maven-project:jar:2.2.1, org.apache.maven:maven-plugin-registry:jar:2.2.1, org.apache.maven:maven-plugin-descriptor:jar:2.2.1, org.apache.maven:maven-artifact-manager:jar:2.2.1, org.apache.maven:maven-monitor:jar:2.2.1, org.apache.maven:maven-toolchain:jar:2.2.1, org.codehaus.plexus:plexus-container-default:jar:1.5.5, org.codehaus.plexus:plexus-classworlds:jar:2.2.2: Failure to transfer org.apache.maven:maven-plugin-api:jar:2.2.1 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven:maven-plugin-api:jar:2.2.1 from/to central (https://repo.maven.apache.org/maven2): Connect timed out pom.xml /loga line 334 Maven Project Build Lifecycle Mapping Problem
Description Resource Path Location Type
CoreException: Could not get the value for parameter compilerId for plugin execution default-testCompile: PluginResolutionException: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.3 or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.apache.maven:maven-plugin-api:jar:2.2.1, org.apache.maven:maven-artifact:jar:2.2.1, org.apache.maven:maven-core:jar:2.2.1, org.apache.maven:maven-settings:jar:2.2.1, org.apache.maven:maven-plugin-parameter-documenter:jar:2.2.1, org.apache.maven:maven-profile:jar:2.2.1, org.apache.maven:maven-model:jar:2.2.1, org.apache.maven:maven-repository-metadata:jar:2.2.1, org.apache.maven:maven-error-diagnostics:jar:2.2.1, org.apache.maven:maven-project:jar:2.2.1, org.apache.maven:maven-plugin-registry:jar:2.2.1, org.apache.maven:maven-plugin-descriptor:jar:2.2.1, org.apache.maven:maven-artifact-manager:jar:2.2.1, org.apache.maven:maven-monitor:jar:2.2.1, org.apache.maven:maven-toolchain:jar:2.2.1, org.codehaus.plexus:plexus-container-default:jar:1.5.5, org.codehaus.plexus:plexus-classworlds:jar:2.2.2: Failure to transfer org.apache.maven:maven-plugin-api:jar:2.2.1 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven:maven-plugin-api:jar:2.2.1 from/to central (https://repo.maven.apache.org/maven2): Connect timed out pom.xml /loga line 334 Maven Project Build Lifecycle Mapping Problem
Description Resource Path Location Type
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (execution: default-compile, phase: compile) pom.xml /loga line 334 Maven Project Build Lifecycle Mapping Problem
Description Resource Path Location Type
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.3:testCompile (execution: default-testCompile, phase: test-compile) pom.xml /loga line 334 Maven Project Build Lifecycle Mapping Problem
And if try to update maven project I get an error alert
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-war-plugin:2.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-war-plugin:jar:2.2
Plugin org.apache.maven.plugins:maven-war-plugin:2.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-war-plugin:jar:2.2
Same project I imported in windows environment and there were no errors Where as in ubuntu i see above errors. I have spent 10 hours googling with out any solution. Any help appreciated.

Error when importing project with maven

I'm starting to learn AngularJS and spring at work. I'm following this tutorial.
There it has a sample code that you can download from git
I'm following this steps:
Clone the project.
Eclipse -> Import -> maven project -> project called "basic"( which I download from the git source).
The problem is that maven detects the following errors:
Description Resource Path Location Type
Failure to transfer org.apache.maven:maven-core:jar:2.0.6 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven:maven-core:jar:2.0.6 from/to central (https://repo.maven.apache.org/maven2): The operation was cancelled. pom.xml /basic line 1 Maven Configuration Problem
Description Resource Path Location Type
CoreException: Could not get the value for parameter compilerId for plugin execution default-compile: PluginResolutionException: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.apache.maven:maven-artifact:jar:2.0.9, org.apache.maven:maven-toolchain:jar:1.0, org.apache.maven.shared:maven-shared-utils:jar:0.1, com.google.code.findbugs:jsr305:jar:2.0.1, org.codehaus.plexus:plexus-component-annotations:jar:1.5.5, org.codehaus.plexus:plexus-compiler-api:jar:2.2, org.codehaus.plexus:plexus-classworlds:jar:2.2.2, org.apache.xbean:xbean-reflect:jar:3.4, log4j:log4j:jar:1.2.12, commons-logging:commons-logging-api:jar:1.1, com.google.collections:google-collections:jar:1.0, junit:junit:jar:3.8.2: Failure to transfer org.apache.maven:maven-artifact:jar:2.0.9 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven:maven-artifact:jar:2.0.9 from/to central (https://repo.maven.apache.org/maven2): The operation was cancelled. pom.xml /basic line 14 Maven Project Build Lifecycle Mapping Problem
I really don't understand the error, and I don't know where to look up for a fix.

Can't create maven project in STS

I can't create new maven project using this IDE Spring Tool Suite.
It show me the following errors
CoreException: Could not calculate build plan: Plugin
org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its
dependencies could not be resolved: Failed to read artifact descriptor
for org.apache.maven.plugins:maven-compiler-plugin:jar:3.1:
ArtifactResolutionException: Could not transfer artifact
org.apache.maven.plugins:maven-compiler-plugin:pom:3.1 from/to central
(https://repo.maven.apache.org/maven2): proxy.example.com
enter image description here
the version of my STS is 3.7.1 RELEASE
Could any one please help
I had the exact same problem and since I read somewhere that the error was caused by a cached file, I fixed it by deleting all the files under de .m2 repository folder. The next time I built the project I had to download all the dependencies again but it was worth it.

Categories