Error Building Maven project when I do maven install - java

I'm trying to build a Maven Project using Spring Tool Suit from Eclipse and I'm having an error when I do the Maven Install.
First I do the Maven Clean and it works properly but when I do the maven install this error appears:
Failed to execute goal org.codehaus.mojo:build-helper-maven-plugin:1.9.1:regex-properties
(set-properties-with-regex) on project qad-webshell-pom:
Execution set-properties-with-regex of goal
org.codehaus.mojo:build-helper-maven-plugin:1.9.1:regex-properties failed:
Plugin org.codehaus.mojo:build-helper-maven-plugin:1.9.1 or
one of its dependencies could not be resolved:
Failed to collect dependencies at org.codehaus.mojo:build-helper-maven-plugin:jar:1.9.1 ->
org.beanshell:bsh:jar:2.0b4: Failed to read artifact descriptor
for org.beanshell:bsh:jar:2.0b4:
Could not transfer artifact org.beanshell:bsh:pom:2.0b4 from/to
central (http://repo1.maven.org/maven2):
Cannot access http://repo1.maven.org/maven2 with type default
using the available connector factories:
BasicRepositoryConnectorFactory:
Cannot access http://repo1.maven.org/maven2 using the registered transporter
factories: WagonTransporterFactory: java.util.NoSuchElementException
[ERROR] role: org.apache.maven.wagon.Wagon
[ERROR] roleHint: http'

I had the same issue.
I have restarted Eclipse, then go on the project specific maven module in which you have the error, right click > Maven > Update Project ...
After the Update on the specific module the Maven install worked without any error.

Related

Maven compiler-plugin access forbidden

Suddenly I started seeing this error when running a maven project on Jenkins
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project my-project:
Execution default-compile of goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile failed: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.8.0 or one of its dependencies could not be resolved:
Failed to collect dependencies at org.apache.maven.plugins:maven-compiler-plugin:jar:3.8.0 -> org.codehaus.groovy:groovy-eclipse-compiler:pom:3.0.0-01: Failed to read artifact descriptor for org.codehaus.groovy:groovy-eclipse-compiler:pom:3.0.0-01:
Could not transfer artifact org.codehaus.groovy:groovy-eclipse-compiler:pom:3.0.0-01 from/to bintray (https://dl.bintray.com/groovy/maven):
Authorization failed for https://dl.bintray.com/groovy/maven/org/codehaus/groovy/groovy-eclipse-compiler/3.0.0-01/groovy-eclipse-compiler-3.0.0-01.pom 403 Forbidden -> [Help 1]
Any idea what might be the issue?
org.codehaus.groovy:groovy-eclipse-compiler is available on Maven Central which is also recommended on its home page:
Current version of the groovy-eclipse-compiler adapter: maven-centralv3.7.0

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 transfer artifact from/to repo1.maven.org

I am trying to build Apache Flume using mvn install -DskipTests on SLES12.
Error Message goes:
[ERROR] Failed to execute goal on project flume-ng-elasticsearch-sink: Could not resolve dependencies for project org.apache.flume.flume-ng-sinks:flume-ng-elasticsearch-sink:jar:1.7.0-SNAPSHOT: Failed to collect dependencies at org.elasticsearch:elasticsearch:jar:0.90.1: Failed to read artifact descriptor for org.elasticsearch:elasticsearch:jar:0.90.1: Could not transfer artifact org.elasticsearch:elasticsearch:pom:0.90.1 from/to repo1.maven.org (http://repo1.maven.org/maven2): init failed: /dev/[u]random closed? -> [Help 1]
I noticed that the settings.xml is missing in .m2 folder. I could think about 2 possible reasons:
lastUpdated file in .m2 prevent Maven to progress
it is behind the proxy.
How to verify which goes wrong and fix it?
Problem solved after I changed the open JDK version.

Maven error : Could not calculate build plan

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

Error in Updating Maven - Spring MVC project

I am new to Spring MVC framework.I am trying to develop a web application following these steps here. I was going on well until I reached the stage of updating Maven to include dependencies; I got the following error after right click project --> Maven --> Update Project -tick Force Update of Snapshots/Releases --> Finish.
UPDATE
The following errors is shown in the IDE:
`ArtifactDescriptorException: Failed to read artifact descriptor for javax.inject:javax.inject:jar:1: ArtifactResolutionException: Could not transfer artifact javax.inject:javax.inject:pom:1 from/to central (http://repo.maven.apache.org/maven2): repo.maven.apache.org pom.xml /HelloSpringMVC line 1 Maven Dependency Problem`
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): repo.maven.apache.org pom.xml /HelloSpringMVC line 136 Maven Project Build Lifecycle Mapping Problem
Set up the same example at my end and generated the issue.
Perform the following steps to fix the issue
right click project --> Maven --> Update Project -tick Force Update of Snapshots/Releases --> Finish.

Categories