Search code examples
eclipsemavenssl-certificatetruststoremaven-resources-plugin

Could not transfer artifact from/to central because of InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty


When I try to install the pom.xml of maven project, I get the following error. Please help.

Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.6:resources (default-resources) on project pm: Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:2.6:resources failed: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Could not transfer artifact classworlds:classworlds:jar:1.1 from/to central (https://repo.maven.apache.org/maven2): java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty


Solution

  • I had the same issue when compiling on a remote CI server. In the end, forcing the location of the trustStore when compiling with Maven solved the problem for me:

    -Djavax.net.ssl.trustStore=/usr/java/jdk1.8.0_91/jre/lib/security/cacerts

    The actual path will be different based on your JDK installation.

    I speculate (not sure) that the problem arises if you have more than one JDK, some old one does not have proper certificate, and somehow Maven picks up that old one even if you are using the right javac