You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Christoph Läubrich <ma...@laeubi-soft.de> on 2023/02/09 14:38:49 UTC

maven.config / jvm.config / -D options

I have a question on this statement below that -D has not to go into 
maven.config but in jvm config.

I think the difference is more that -D in jvm.config become a "real" 
system-property (because it is evaluated before maven jvm start up), but 
-D options specified in maven.config actually become user-propertties 
AND "soft" systemproperties (as they are set after the JVM has started) 
see the following code:

https://github.com/apache/maven/blob/master/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L1465-L1492

So -D is a valid JVM option AND a valid mvn commandline option (named 
SET_USER_PROPERTY == -D)

Also https://maven.apache.org/ref/3.9.0/maven-embedder/cli.html mention 
-D as a cli option!

Also prior to 3.9.x the contents of the file was split by *any* space see:
https://github.com/apache/maven/blob/maven-3.8.x/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L380-L399

Also reading this I can't find a indication that new lines are required:
https://maven.apache.org/configure.html



Am 31.01.23 um 16:00 schrieb Michael Osipov:
> Am 2023-01-31 um 01:35 schrieb Dan Tran:
>> run into this issue
>>
>> "Unable to parse maven.config file options: Unrecognized maven.config 
>> file
>> entries: [ -e --fail-fast -Djavax.xml.accessExternalSchema=all
>> -Daether.connector.resumeDownloads=false]"
>>
>> The workaround is to break it into multiple lines
> 
> This is not a workaround. Your input is wrong in two ways:
> 
> 1. Each arg has to be in one line: 
> https://gitbox.apache.org/repos/asf?p=maven.git;a=commit;h=331c5c3435cdfa8dc3f35a7b38503bdac2654206
> 2. Java system props must *not* be passed via maven.config, but via 
> MAVEN_OPTS or jvm.config only, e.g.,  -Djavax.xml.accessExternalSchema=all
> 
> M
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: maven.config / jvm.config / -D options

Posted by Michael Osipov <mi...@apache.org>.
Am 2023-02-09 um 15:38 schrieb Christoph Läubrich:
> I have a question on this statement below that -D has not to go into 
> maven.config but in jvm config.

No, this is wrong and I didn't say that.

> I think the difference is more that -D in jvm.config become a "real" 
> system-property (because it is evaluated before maven jvm start up), but 
> -D options specified in maven.config actually become user-propertties 
> AND "soft" systemproperties (as they are set after the JVM has started) 
> see the following code:
> 
> https://github.com/apache/maven/blob/master/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L1465-L1492
> 
> So -D is a valid JVM option AND a valid mvn commandline option (named 
> SET_USER_PROPERTY == -D)
> 
> Also https://maven.apache.org/ref/3.9.0/maven-embedder/cli.html mention 
> -D as a cli option!

Actually, no. The real problem is 
https://github.com/apache/maven/blob/7b38457506544854cdd26aa1d49608050217b923/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L1494-L1503.

Java system properties != Maven user properties. It is unfortunate, for 
historical reasons, that both have been mixed. You cannot reliably set a 
system property *after* 'mvn'. Some will not even be effective. Slawek 
and me are working on cleaning this up in the future. Therefore, I have 
clearly renamed the help output in Maven to denote that those are user 
properties and *not* system properties. It is also unfortunate that 
Maven uses '-D' for this, I would have preferred '-P', but this is taken 
already.

> Also prior to 3.9.x the contents of the file was split by *any* space see:
> https://github.com/apache/maven/blob/maven-3.8.x/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java#L380-L399
> 
> Also reading this I can't find a indication that new lines are required:
> https://maven.apache.org/configure.html

You also can't find the opposite. There is no formal specification. That 
is the real problem. We have failed to provide clear instructions for 
both config -- rather opts -- files.

> Am 31.01.23 um 16:00 schrieb Michael Osipov:
>> Am 2023-01-31 um 01:35 schrieb Dan Tran:
>>> run into this issue
>>>
>>> "Unable to parse maven.config file options: Unrecognized maven.config 
>>> file
>>> entries: [ -e --fail-fast -Djavax.xml.accessExternalSchema=all
>>> -Daether.connector.resumeDownloads=false]"
>>>
>>> The workaround is to break it into multiple lines
>>
>> This is not a workaround. Your input is wrong in two ways:
>>
>> 1. Each arg has to be in one line: 
>> https://gitbox.apache.org/repos/asf?p=maven.git;a=commit;h=331c5c3435cdfa8dc3f35a7b38503bdac2654206
>> 2. Java system props must *not* be passed via maven.config, but via 
>> MAVEN_OPTS or jvm.config only, e.g.,  
>> -Djavax.xml.accessExternalSchema=all
>>
>> M
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 


RE: maven.config / jvm.config / -D options

Posted by Jeremy Landis <je...@hotmail.com>.
I believe the -D option noted was one that was not related to maven itself but rather jvm.  We use -D there for very specific maven item only and its fine.  The new lines are required for sure both in 3.9.0 and 4.0.0 alphas.  We have already scaled this out as an automated change where I work to address the maven.config at some time maven bumps up via maven wrapper settings.  To be more specific, we are using -Daether.checksums.algorithms=SHA512,SHA-256,SHA-1,MD5 in the maven.config as only -D in our case.  I have many OSS projects too that have that same setup.  Sure that also works moving it into jvm.config but its very maven specific so it makes more sense in maven.config IMHO.

-----Original Message-----
From: Christoph Läubrich <ma...@laeubi-soft.de> 
Sent: Thursday, February 9, 2023 9:39 AM
To: dev@maven.apache.org
Subject: maven.config / jvm.config / -D options

I have a question on this statement below that -D has not to go into maven.config but in jvm config.

I think the difference is more that -D in jvm.config become a "real" 
system-property (because it is evaluated before maven jvm start up), but -D options specified in maven.config actually become user-propertties AND "soft" systemproperties (as they are set after the JVM has started) see the following code:

https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fmaven%2Fblob%2Fmaster%2Fmaven-embedder%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fmaven%2Fcli%2FMavenCli.java%23L1465-L1492&data=05%7C01%7C%7C0e31227901824ea3f55008db0aab6565%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638115503525180590%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=pqVdZ%2BxaeNpj83ER5ri%2FFpVKKN8MRvYaUd8C%2BgtdQaA%3D&reserved=0

So -D is a valid JVM option AND a valid mvn commandline option (named SET_USER_PROPERTY == -D)

Also https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmaven.apache.org%2Fref%2F3.9.0%2Fmaven-embedder%2Fcli.html&data=05%7C01%7C%7C0e31227901824ea3f55008db0aab6565%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638115503525180590%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=h8qBkhxbZXPCpYmmyfsKLnTpbGc0qxEgsI5IHDulW0w%3D&reserved=0 mention -D as a cli option!

Also prior to 3.9.x the contents of the file was split by *any* space see:
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fmaven%2Fblob%2Fmaven-3.8.x%2Fmaven-embedder%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fmaven%2Fcli%2FMavenCli.java%23L380-L399&data=05%7C01%7C%7C0e31227901824ea3f55008db0aab6565%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638115503525180590%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=roUc9kOUHcO8R2%2FoYpCGkfy6WLTP5T3bE2s4c2T0b5Q%3D&reserved=0

Also reading this I can't find a indication that new lines are required:
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmaven.apache.org%2Fconfigure.html&data=05%7C01%7C%7C0e31227901824ea3f55008db0aab6565%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638115503525180590%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=%2FC4oKQzRScoPPlk4rWIqAfI577SEZ9jrSLaqxRdRMgA%3D&reserved=0



Am 31.01.23 um 16:00 schrieb Michael Osipov:
> Am 2023-01-31 um 01:35 schrieb Dan Tran:
>> run into this issue
>>
>> "Unable to parse maven.config file options: Unrecognized maven.config 
>> file
>> entries: [ -e --fail-fast -Djavax.xml.accessExternalSchema=all
>> -Daether.connector.resumeDownloads=false]"
>>
>> The workaround is to break it into multiple lines
> 
> This is not a workaround. Your input is wrong in two ways:
> 
> 1. Each arg has to be in one line: 
> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitbo
> x.apache.org%2Frepos%2Fasf%3Fp%3Dmaven.git%3Ba%3Dcommit%3Bh%3D331c5c34
> 35cdfa8dc3f35a7b38503bdac2654206&data=05%7C01%7C%7C0e31227901824ea3f55
> 008db0aab6565%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C63811550352
> 5180590%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLC
> JBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=GVnU8ToabKngYqsv3Rm
> T5On4r7WyglQuT19XlPwdlYk%3D&reserved=0
> 2. Java system props must *not* be passed via maven.config, but via 
> MAVEN_OPTS or jvm.config only, e.g.,  
> -Djavax.xml.accessExternalSchema=all
> 
> M
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org For 
> additional commands, e-mail: dev-help@maven.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org For additional commands, e-mail: dev-help@maven.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org