Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven Command Line Args in the settings.xml

Tags:

Good afternoon,

I'm trying to find out whether there is a possibility to outsource Command Line Args in the Settings.xml.

I can't use the MAVEN_OPTS Env-Var and the .mavenrc file, but i need the Settings in every project. It is important that no plugins are used which are not included after the installation (the settings are needed for a connection with the repository).

Settings:

 -Djavax.net.ssl.trustStore=VALUE
 -Djavax.net.ssl.trustStorePassword=VALUE
 -Djavax.net.ssl.keyStore=VALUE
 -Djavax.net.ssl.keyStorePassword=VALUE
 -Djavax.net.ssl.keyStoreType=VALUE
 -Dmaven.wagon.http.ssl.insecure=VALUE
 -Dmaven.wagon.http.ssl.allowall=VALUE
 -Dmaven.wagon.http.ssl.ignore.validity.dates=VALUE

I hope i haven't overlook somthing obvious... Thanks in advance, LocXar

EDIT-1: Maven Version: Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)

EDIT-2: I have tried it like this, but it does not work: <javax.net.ssl.trustStore>VALUE</javax.net.ssl.trustStore>

like image 849
LocXar Avatar asked Apr 05 '16 12:04

LocXar


1 Answers

The best thing is to use the ${maven.projectBasedir}/.mvn/maven.config if you like to use special configurations elements for Maven itself (for example: -T3 ..). Furthermore you can use things for the JVM via ${maven.projectBasedir}/.mvn/jvm.config which means in your case you should use the jvm.config with the following content:

-Djavax.net.ssl.trustStore=VALUE
-Djavax.net.ssl.trustStorePassword=VALUE
-Djavax.net.ssl.keyStore=VALUE
-Djavax.net.ssl.keyStorePassword=VALUE
-Djavax.net.ssl.keyStoreType=VALUE
-Dmaven.wagon.http.ssl.insecure=VALUE
-Dmaven.wagon.http.ssl.allowall=VALUE
-Dmaven.wagon.http.ssl.ignore.validity.dates=VALUE

So you can put that in your project and check in this within your project. So this makes .mavenrc and MAVEN_OPTS superfluous. This is documented in the Release Notes for Maven 3.3.1.

But I have to say that you like to set the above system properties I got the impression you would like to ignore the certificates within an https connection which does not makes sense.

like image 60
khmarbaise Avatar answered Sep 28 '22 03:09

khmarbaise