0

I have been facing this annoying issue of certificate during mvn clean install execution.

PS C:\Users\milan\service> mvn clean install
[INFO] Scanning for projects...
Downloading from spring-milestones: https://repo.spring.io/milestone/org/springframework/boot/spring-boot-starter-parent/2.2.0.M6/spring-boot-starter-parent-2.2.0.M6.pom
Downloading from central: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/2.2.0.M6/spring-boot-starter-parent-2.2.0.M6.pom
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for com.demo.microservices:service:0.0.1-SNAPSHOT: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.2.0.M6 from/to spring-milestones (https://repo.spring.io/milestone): transfer failed for https://repo.spring.io/milestone/org/springframework/boot/spring-boot-starter-parent/2.2.0.M6/spring-boot-starter-parent-2.2.0.M6.pom and 'parent.relativePath' points at no local POM @ line 4, column 11
 @
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR]   The project com.demo.microservices:service:0.0.1-SNAPSHOT (C:\Users\milan\service\pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM for com.demo.microservices:service:0.0.1-SNAPSHOT: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.2.0.M6 from/to spring-milestones (https://repo.spring.io/milestone): transfer failed for https://repo.spring.io/milestone/org/springframework/boot/spring-boot-starter-parent/2.2.0.M6/spring-boot-starter-parent-2.2.0.M6.pom and 'parent.relativePath' points at no local POM @ line 4, column 11: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [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

I have found solution which is working fine.

enter image description here

Is there any solution, That can resolve this issue once and for all ?

System :

Apache Maven 3.8.4 
Maven home: C:\apache-maven-3.8.4
Java version: 17.0.1, vendor: Eclipse Adoptium, runtime: C:\Program Files\Eclipse Adoptium\jdk-17.0.1.12-hotspot
Default locale: en_IN, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
Milan
  • 147
  • 1
  • 4
  • 16
  • Sounds like you are adding the site certificate to your trust store, and when it expires every few months, you have to do it again. Instead, make sure that the root CA certificate is in your trust store (DigiCert Global Root CA). If not, better find out why and solve from there. – erickson Apr 21 '22 at 16:31
  • @erickson Yes I am loading certificates, I need to check (DigiCert Global Root CA) I have not done that yet. – Milan Apr 22 '22 at 04:59
  • @all I have tried to replace cacert of `Eclipse Adoptium\jdk-17.0.1.12-hotspot` with `\Eclipse Adoptium\jre-8.0.312.7-hotspot` and taken backup of the original one to fix repetitive loading issue. Will update here If this works for longer than a week. – Milan Apr 22 '22 at 10:48

1 Answers1

1

I am able to resolve this issue by replacing the cacert file. To be more precise I have replace cacert of Eclipse Adoptium\jdk-17.0.1.12-hotspot with Eclipse Adoptium\jre-8.0.312.7-hotspot to fix it.

Things to my surprises is that, After replacing new cacaert file I did not had to use keytool to load certificate manually. It's still mystery why old cacert file was causing trouble.

NOTE: Take backup of original cacert file before you replace with new one.

try this solution if still not resolved.

Milan
  • 147
  • 1
  • 4
  • 16