Allow Autosigned https certificate on Maven plugin - Sonatype Lifecycle & Repository Firewall - Sonatype Community

Allow Autosigned https certificate on Maven plugin

post by c.tixier on Aug 23, 2022

Hello,

We have a test instance for lifecycle with an autosigned certificate. I try to launch maven plugin on a my projet and i can’t avoid the certificate check with -Dmaven.wagon.http.ssl.insecure=true option

mvn clean install com.sonatype.clm:clm-maven-plugin:evaluate -Dclm.serverUrl= https://myServer -Dclm.applicationId=app_id -Dmaven.wagon.http.ssl.insecure=false

give me this error

[ERROR] Failed to execute goal com.sonatype.clm:clm-maven-plugin:2.31.1-01:evaluate (default-cli) on project myproject: Could not communicate with IQ Server: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target → [Help 1]

is there any option to set on command line to avoid certificate validation ?

post by rseddon on Aug 23, 2022

You need to set that in MAVEN_OPTS environment variable, see here:

post by c.tixier on Aug 23, 2022

i try :

export MAVEN_OPTS=“-Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true”

this is recorded

env | grep MAVEN_OPTS

MAVEN_OPTS=-Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true

still have the same error. i also see it inside the log

[DEBUG] properties used … env.MAVEN_OPTS= -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true … maven.wagon.http.ssl.insecure=true …

I also try to put into the plugin configuration without success :

  <groupId>com.sonatype.clm</groupId>
  <artifactId>clm-maven-plugin</artifactId>
  <version>2.31.1-01</version>
  <configuration>
   <maven.wagon.http.ssl.insecure>true</maven.wagon.http.ssl.insecure>
   <maven.wagon.http.ssl.allowall>true</maven.wagon.http.ssl.allowall>
   <maven.wagon.http.ssl.ignore.validity.dates>true</maven.wagon.http.ssl.ignore.validity.dates>
  </configuration>