TL;DR
How to make Eclipse's built-in Maven connect to an HTTPS repository that uses certificate-based authentication?
It seems that m2e
is able to find the keystores, but unable to connect. Command-line Maven works like a charm using exactly the same keystores. Run as -> Maven build
works with external Maven and not with the embedded one.
Problem
I have a Maven project with a dependency. That dependency is available in a repository that uses SSL certificate-based authentication in addition to regular username-password combination. I need to make it work in Eclipse Luna, with the built-in Maven. All I am able to get is handshake_failure
. Investigation of the logs shows that the built-in Maven is unable to find a matching certificate.
When I use Run as -> Maven build
with an external Maven, or command-line Maven, it successfully connects to the repository and fetches the artifact exactly as needed.
The interesting thing is, both external and embedded Mavens have the same version (3.2.3).
Setup
I pass these parameters through eclipse.ini
:
-Djavax.net.ssl.trustStore=java.cacerts
-Djavax.net.ssl.trustStorePassword=******
-Djavax.net.ssl.keyStore=private.cacerts
-Djavax.net.ssl.keyStorePassword=******
-Djavax.net.debug=ssl,handshake
The trustStore
file contains:
- the whole certificate chain for the repository I connect to (the chain ends with a self-signed certificate), one of them being stored under the alias
repository.location.url
(literal repository location here, e.g. myrepository.com) - certificate for maven central
The keyStore
file contains an imported PKCS certificate under an alias of the repository.
There seems to be no problem at all with the setup, as the command-line Maven works. If I use external Maven or command-line one, it works. If I swich to embedded one (which is always used for resolving dependencies), handshake error
shows up.
What am I doing wrong? I might be missing something completely obvious. Any help would be appreciated.