简体   繁体   中英

Maven Command Line Args in the settings.xml

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>

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 thise 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.

It seems me you can define all arguments in Maven Settings profile with properties: https://maven.apache.org/settings.html#Profiles

HIH

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM