Issue
I am working on a demo of Quarkus.io at work, and I'm facing a problem with connecting to the company Maven repo, as that uses mutual TLS for authentication.
I.e. when I run the test
-target the getting-started-testing
from the quarkus-quickstarts, I am faced with the following error:
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.acme.quickstart.GreetingResourceTest
[ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 3.139 s <<< FAILURE! - in org.acme.quickstart.GreetingResourceTest
[ERROR] testHelloEndpoint Time elapsed: 0.012 s <<< ERROR!
org.junit.jupiter.api.extension.TestInstantiationException: TestInstanceFactory [io.quarkus.test.junit.QuarkusTestExtension] failed to instantiate test class [org.acme.quickstart.GreetingResourceTest]: io.quarkus.bootstrap.resolver.AppModelResolverException: Failed to collect dependencies for io.quarkus:quarkus-resteasy-deployment:jar:1.2.0.Final
Caused by: io.quarkus.bootstrap.resolver.maven.DeploymentInjectionException: io.quarkus.bootstrap.resolver.AppModelResolverException: Failed to collect dependencies for io.quarkus:quarkus-resteasy-deployment:jar:1.2.0.Final
Caused by: io.quarkus.bootstrap.resolver.AppModelResolverException: Failed to collect dependencies for io.quarkus:quarkus-resteasy-deployment:jar:1.2.0.Final
Caused by: org.eclipse.aether.collection.DependencyCollectionException: Failed to collect dependencies at io.quarkus:quarkus-resteasy-server-common-deployment:jar:1.2.0.Final -> io.quarkus:quarkus-core-deployment:jar:1.2.0.Final -> io.quarkus:quarkus-bootstrap-core:jar:1.2.0.Final -> org.apache.maven.resolver:maven-resolver-transport-wagon:jar:1.1.1 -> org.apache.maven.wagon:wagon-provider-api:jar:3.3.3
Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.apache.maven.wagon:wagon-provider-api:jar:3.3.3
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact org.apache.maven.wagon:wagon-provider-api:pom:3.3.3 from/to corporate-public (https://maven.corporate.net/content/repositories/corporate-public): Received fatal alert: handshake_failure
Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact org.apache.maven.wagon:wagon-provider-api:pom:3.3.3 from/to corporate-public (https://maven.corporate.net/content/repositories/corporate-public): Received fatal alert: handshake_failure
Caused by: org.apache.maven.wagon.TransferFailedException: Received fatal alert: handshake_failure
Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
The -Djavax.net.ssl.keyStore*
properties are normally picked up by Maven from ~/.mavenrc
or MAVEN_OPTS
environment properties, but how do I specify them for running the Quarkus tests?
It should be obvious, but I'll state it anyways - switching to use the public repos, is not an acceptable solution.
Solution
In case anybody else has this problem, a workaround is propagating the javax.net.ssl.*
system properties to the Maven Surefire plugin, e.g. adding these lines to the Surefire configuration:
<javax.net.ssl.keyStoreType>${javax.net.ssl.keyStoreType}</javax.net.ssl.keyStoreType>
<javax.net.ssl.keyStore>${javax.net.ssl.keyStore}</javax.net.ssl.keyStore>
<javax.net.ssl.keyStorePassword>${javax.net.ssl.keyStorePassword}</javax.net.ssl.keyStorePassword>
(This answer is totally ninja'ing the information in @tveon's Quarkus tests fails mTLS authentication against internal Maven repository issue in Quarkus' GitHub repo).
Answered By - snemarch