0
votes

I have a huge problem with Maven on my Ubuntu 17.10. In my pom.xml I use the maven-assembly-plugin.
Every time I run Maven with mvn clean package in the root of my project the execution fails and in the Stack-trace I can find the error message

Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (https://repo.maven.apache.org/maven2): java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty

I already reinstalled Maven on my Ubuntu and searched through Google for many hours. It seems that Maven/Java can't connect to Maven Central over SSL. I found a way to use Maven and ignore SSL with mvn clean package -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true but this also didn't work.

The error occurs in all my Maven projects so I think the problem is not in the pom.xml.

The debug log with stacktrace is on Pastebin

EDIT: I checked my cacerts and found the .pem for digicert which validated the Certificate for Maven Central

Posted an Screenshot here!

2
you can try installing that plugin manually in your local maven repo. But if you have troubles connecting to the central one you will probably have more problems with other dependenciesVeselin Davidov
What JDK are you using?Veselin Davidov
Yeah that would be possible, but I would also like to understand why this error is happening. And a quick fix would probably not fix all the problems. java version "1.8.0_171" Java(TM) SE Runtime Environment (build 1.8.0_171-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode) justtoplayslow
wiki.52north.org/Documentation/MavenIssues -> check this out if you use open jdk or by chance don't have the SSL certificates available you might need to point to them and try (instead of ignoring)Veselin Davidov
I use Oracle Javajusttoplayslow

2 Answers

1
votes

I was facing the same issue while running maven clean just to discover later that it was my Organization firewall that was causing the ACCESS_DENIED to be thrown from the AbstractHTTPClient. If you are running behind a company firewall can you update your settings.xml with the Firewall settings.

Check if you are running behind your company proxy. If yes then you may need to add your organization's proxy settings in settings.xml.

<settings>
  <proxies>
   <proxy>
      <id>SOME ID</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>PROXY_HOST</host>
      <port>PROXY_PORT</port>
    </proxy>
  </proxies>
</settings>
0
votes

This normally works out of the box. Either your JDK cacerts file (JDK_HOME\jre\lib\security\cacerts) is corrupted or someone is intercepting your network traffic and replacing TLS certificate used by Maven Central (common in a corporate environment).

Inspect the cacerts file using keytool shipped with your JDK and confirm that the certificate chain used by Maven Central is trusted. You can open Maven Central in the web browser and inspect the actual TLS certificate. If you trust it, add it to your JDK cacerts.