March 3, 2016

Maven is unable to connect to repository.apache.org with "peer not authenticated"

Symptom: Maven is unable to connect to repository.apache.org with "peer not authenticated".
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy (default-deploy) on project hama-parent: Failed to retrieve remote metadata org.apache.hama:hama-parent:0.7.1-SNAPSHOT/maven-metadata.xml: Could not transfer metadata org.apache.hama:hama-parent:0.7.1-SNAPSHOT/maven-metadata.xml from/to apache.snapshots.https (https://repository.apache.org/content/repositories/snapshots): peer not authenticated -> [Help 1]
    [ERROR] 
This is usually caused by using a SSL certificate on Nexus. you can use the keytool command like below:
 $ sudo keytool -importcert -file ~/Downloads/apache.crt -alias apache.org -keystore /usr/lib/jvm/java-8-oracle/jre/lib/security/cacerts