maven-mvnd icon indicating copy to clipboard operation
maven-mvnd copied to clipboard

Support for MAVEN_OPTS

Open gnodet opened this issue 3 years ago • 2 comments
trafficstars

It would make sense to support the MAVEN_OPTS environment variable. See https://github.com/apache/maven-mvnd/issues/567

gnodet avatar Jan 07 '22 10:01 gnodet

Two caveats come to my mind:

  • I use both mvn and mvnd and I might want to have less Xmx for mvn than for mvnd will I be able to reach that?
  • Precendence between MAVEN_OPTS and mvnd.jvmArgs: would one replace the other? Or would we try to merge both before passing the args to java?

ppalaga avatar Jan 07 '22 11:01 ppalaga

Two-cents drive-by comment: generally more specific settings should override more general settings. System properties are more specific than environment variables, since the former are per-JVM, while an environment can contain multiple JVMs. Similarly, between on-disk properties and environment properties I would say that the latter should take precedence, since the latter can be specificed per-process, while the former apply to all processes.

I.e., in order from highest to lower precedence:

  • The mvnd.jvmArgs system property.
  • The MAVEN_OPTS environment property.
  • The mvnd.properties properties file.

Afaik most software follows these rules. Examples include Spring and the AWS SDK.

Stephan202 avatar Jan 07 '22 12:01 Stephan202