How to find the cause of a Maven build error? - maven

I try to make a local Maven build.
% mvn help:effective-settings
[INFO] Scanning for projects...
Downloading: http://example.com/nexus/content/groups/public/org/springframework/boot/spring-boot-starter-parent/2.1.2.RELEASE/spring-boot-starter-parent-2.1.2.RELEASE.pom
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for example.components.discovery:example-app:01-SNAPSHOT: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.1.2.RELEASE from/to nexus (http://example.com/nexus/content/groups/public): Access denied to: http://example.com/nexus/content/groups/public/org/springframework/boot/spring-boot-starter-parent/2.1.2.RELEASE/spring-boot-starter-parent-2.1.2.RELEASE.pom , ReasonPhrase:Forbidden. and 'parent.relativePath' points at no local POM # line 12, column 10
#
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project example.components.discovery:example-app:01-SNAPSHOT (/Users/me/workspace/example-app/pom.xml) has 1 error
[ERROR] Non-resolvable parent POM for example.components.discovery:example-app:99.99.99-SNAPSHOT: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.1.2.RELEASE from/to nexus (http://example.com/nexus/content/groups/public): Access denied to: http://example.com/nexus/content/groups/public/org/springframework/boot/spring-boot-starter-parent/2.1.2.RELEASE/spring-boot-starter-parent-2.1.2.RELEASE.pom , ReasonPhrase:Forbidden. and 'parent.relativePath' points at no local POM # line 12, column 10 -> [Help 2]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
Some noticeable facts:
I get the same error on other projects with the same Spring dependency.
Co-workers don’t have this problem when they run a Maven build of the project.
Before introducing Nexus, the Maven build was run successfully, and so did for other Spring projects.
If there were some syntax errors in the settings.xml, the above error would show first and follow by complaints of syntax errors in the settings.xml.
My settings.xml seems to have the same structure as my co-worker’s who can run the Maven build successfully, the user credentials are different, of course.
The above facts eliminate all possible causes stated in the help 1 document. Among 6 possible causes stated in the help 2 document, the only possible cause is #4 given the above facts. We have a tool to generate the settins.xml file and use Maven encryption to encrypt the password for the file. I don't know how to verify whether the encrypted password is correct or not. Any other possible causes?

Related

Maven is unable to load dependencies from Central repository

I am trying to create Spring Boot application with Netbeans Wizard. However, I get an error right after creation.
Downloading: http://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/2.2.4.RELEASE/spring-boot-starter-parent-2.2.4.RELEASE.pom
The build could not read 1 project -> [Help 1]
The project com.example:demo:0.0.1-SNAPSHOT (C:\Users\me\application\pom.xml) has 1 error
Non-resolvable parent POM: Could not transfer artifact
org.springframework.boot:spring-boot-starter-parent:pom:2.2.4.RELEASE from/to central
(http://repo.maven.apache.org/maven2): Failed to transfer file:
http://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-
parent/2.2.4.RELEASE/spring-boot-starter-parent-2.2.4.RELEASE.pom. Return code is:
501 , ReasonPhrase:HTTPS Required. and 'parent.relativePath' points at wrong local POM # line 5, column 10 -> [Help 2]
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/ProjectBuildingException
So, Maven is not getting to the central repository, but can anyone tell me why this is?

maven can't download jar from nexus

There are some mistanken
[ERROR] Failed to execute goal on project vinsuan-road-platform-comm: Could not resolve dependencies for project com.vinsuan.road.paltform:vinsuan-road-platform-comm:jar:1.0-SNAPSHOT: Failed to collect dependencies at com.vinsuan4cloud:vinsuan-common-core:jar:1.0.0: Failed to read artifact descriptor for com.vinsuan4cloud:vinsuan-common-core:jar:1.0.0: Failure to find com.vinsuan4cloud:vinsuan:pom:1.0.0 in http://xxx.xxx.xxx.xxx:9981/repository/sps_group/ was cached in the local repository, resolution will not be reattempted until the update interval of sps_group has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :vinsuan-road-platform-comm`enter code here`
http://xxx.xxx.xxx.xxx:9981 is out company nexus url,So i'am sorry。
then i found some similar problems,their answer are version not match,however,vinsuan-common-core.jar only one version,So i don't know what,i use some operations,such as clean 、compile、install、mvn dependeny:sources,but ide point the mistaken。
The error says Failure to find com.vinsuan4cloud:vinsuan:pom:1.0.0. There should be a pom file beside the jar in the repo in order maven will able to resolve the dependency

Using the parameter "LATEST' while building the project does not work with "mvn clean install"

If we use the 'LATEST' parameter when generating the project, the command 'mvn clean install' errors out. Should this parameter be used or should the latest version be provided in the command?
mvn archetype:generate "-DarchetypeGroupId=com.sap.cloud.s4hana.archetypes" "-DarchetypeArtifactId=scp-cf-tomee" **"-DarchetypeVersion=LATEST**" "-DgroupId=com.sap.cloud.s4hana.examples" "-DartifactId=my-app" "-Dversion=1.0-SNAPSHOT"
Error is
Error:
[INFO] Scanning for projects...
Downloading: https://repo.maven.apache.org/maven2/org/springframework/spring-framework-bom/5.1.1.RELEASE/spring-framework-bom-5.1.1.RELEASE.pom
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Non-resolvable import POM: Could not transfer artifact org.springframework:spring-framework-bom:pom:5.1.1.RELEASE from/to central (https://repo.maven.apache.org/maven2): proxy.myproxy.corp # com.sap.cloud.s4hana:sdk-bom:2.7.1-SNAPSHOT, C:\Users\xxxxxxx\.m2\repository\com\sap\cloud\s4hana\sdk-bom\2.7.1-SNAPSHOT\sdk-bom-2.7.1-SNAPSHOT.pom, line 994, column 25
#[ERROR] The build could not read 1 project -> [Help 1]
[ERROR][ERROR] The project com.sap.cloud.s4hana.examples:address-manager1:1.0-SNAPSHOT (C:\my-app\pom.xml) has 1 error
[ERROR] Non-resolvable import POM: Could not transfer artifact org.springframework:spring-framework-bom:pom:5.1.1.RELEASE from/to central (https://repo.maven.apache.org/maven2): proxy.wdf.sap.corp # com.sap.cloud.s4hana:sdk-bom:2.7.1-SNAPSHOT, C:\Users\xxxxxx\.m2\repository\com\sap\cloud\s4hana\sdk-bom\2.7.1-SNAPSHOT\sdk-bom-2.7.1-SNAPSHOT.pom, line 994, column 25: Unknown host proxy.myproxy.corp -> [Help 2]
[ERROR][ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR][ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
The version 2.7.1-SNAPSHOT in not a released version. It is not available externally (maven-central). So, you cannot download it from maven central. However, 2.6.1 is available. That is why it works.
Please try with RELEASE instead of LATEST or better use released versions directly.
Please also check that settings.xml does not point to an internal snapshot nexus server and delete the local repository in your .m2 directory.
Have you checked your network configuration?
I can see a proxy and unknown host error in the log.

Maven: Can't find artifact on downloaded projects pom

After downloading a pom from a project (which I know builds fine on the remote build tools), I get this error when trying to test it locally:
$ mvn clean install -DskipTests
[INFO] Scanning for projects...
Downloading from central: https://repo.maven.apache.org/maven2/com/x/nms/integration/15.2.0.19/integration-15.2.0.19.pom
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for com.x.oss.itpf.diagmon.taf:your-testware:2.20.7-SNAPSHOT: Could not find artifact com.x.nms:integration:pom:15.2.0.19 in central (httpepo.maven.apache.org/maven2) and 'parent.relativePath' points at wrong local POM # line 5, column 13
#
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.x.oss.itpf.diagmon.taf:ddc-testware:2.20.7-SNAPSHOT (C:\Users\erayfra\Workspace\ddc-testware\pom.xml) has 1 error
[ERROR] Non-resolvable parent POM for com.x.oss.itpf.diagmon.taf:your-testware:2.20.7-SNAPSHOT: Could not find artifact com.x.nms:integration:pom:15.2.0.19 in central (://repo.maven.apache.org/maven2) and 'parent.relativePath' points at wrong local POM # line 5, column 13 -> [Help 2]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
Looks like, the problem is -
Could not find artifact com.x.nms:integration:pom:15.2.0.19
in central (://repo.maven.apache.org/maven2)
So, there are 2 things -
The artifact you are trying to include in your project is not available at the path of repository you specified.(Its the same what error message is saying)
You can change the repository path where maven is trying to find for this artifact : from repo.maven..., to the correct one. You could do this by
modifying the path either in your local pom,
or by changing it globally by editing the settings.xml file localed at .m2/settings.xml. .m2 is a hidden folder under /Users/{yourName}
( same location for both windows and mac)

Maven clean install unable to get artifact from maven central

After cloning the remote repo on to Linux remote machine, I am getting the following errors when trying to run mvn clean install:
[ERROR] The build could not read 1 project -> [Help 1] [ERROR]
[ERROR] Non-resolvable parent POM: Could not transfer artifact xxxxx
from/to central (http://repo.maven.apache.org/maven2): Connection to http://repo.maven.apache.org refused and 'parent.relativePath' points at wrong local POM # line 4, column 10: Connection timed out -> [Help 2]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1]
[ERROR] [Help 2]
These errors occur only when running mvn commands on Linux, the project builds successfully after mvn clean install on Windows environment...
Any ideas as to why this is happening on Linux machine?
Thanks
Connection to http://repo.maven.apache.org refused
The above message seems be due to network failure. As you say it builds successfully on windows and not on Linux, I envisage there must be some different network setting in your linux profile. Had you ever added any proxy? Check maven proxy setting and try again.

Resources