0

I am trying to create a Maven project in Eclipse Oxygen but errors resulted. These are the steps that I did:

  1. Select File -> New -> Maven Project.
  2. On the pop-up window, check "Create a simple project (skip archetype selection), and check "Use default Workspace location" (leaving the location field blank).
  3. Click Next.
  4. Enter "com.xyz" for "Group Id", "test" for "Artifact Id", "0.0.1-SNAPSHOT" for "Version", and "jar" for "Packaging".
  5. Leaving the rest of the fields blank, click Finish.

The project was created with errors. In the Workspace Log, I can see the following:

    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

When I opened the newly created pom.xml, I can see an error:

Multiple annotations found at this line:
- 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: Failure to transfer 
 org.apache.maven.plugins:maven-compiler-plugin:pom:3.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.plugins:maven-
 compiler-plugin:pom:3.1 from/to central (https://repo.maven.apache.org/maven2): sun.security.validator.ValidatorException: PKIX path building failed: 
 sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (execution: default-
 testCompile, phase: test-compile)
- Failure to transfer org.apache.maven.plugins:maven-resources-plugin:pom:2.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.plugins:maven-resources-plugin:pom:2.6 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (execution: default-compile, 
 phase: compile)

Below is what I had previously put in the settings.xml, which contains the proxy settings as I am behind firewall.

    <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                              https://maven.apache.org/xsd/settings-1.0.0.xsd">
    <localRepository/>
    <interactiveMode/>
    <usePluginRegistry/>
    <offline/>
    <pluginGroups/>
    <servers/>
    <mirrors/>
    <proxies>
            <proxy>
                    <id>example-proxy</id>
                    <active>true</active>
                    <protocol>http</protocol>
                    <host>xx.xx.xx.xx</host>
                    <port>80</port>
                    <username>xxxxxxxx</username>
                    <password>xxxxxxxx</password>
                    <nonProxyHosts>localhost|127.0.0.1</nonProxyHosts>
            </proxy>
    </proxies>
    <profiles/>
    <activeProfiles/>
</settings>

It seems that my main problem has got to do with certification path, as shown by the following line which I extracted out from the above errors.

sun.security.validator.ValidatorException: PKIX path building failed: 
 sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

So how do I resolve this certification path error?

user3573403
  • 1,780
  • 5
  • 38
  • 64

2 Answers2

0

Problems using Maven and SSL behind proxy

Here is the thread looks similar to your issue, where you are trying to try to connect to an https remote repository - "https://repo.maven.apache.org/maven2/". Mostly certificate to support HTTPS connections is not included in included in the cacerts file.

cigien
  • 57,834
  • 11
  • 73
  • 112
RoPa
  • 16
  • 9
0

Add SSL certificate to your JDK and then add this in eclipse.ini

-Djavax.net.ssl.trustStore=C:\Program Files\Java\jdk1.8.0_311\jre\lib\security\cacerts

Makatun
  • 947
  • 10
  • 11