When using Maven to build an executable JAR, how do I specify the JVM arguments that are used when the JAR is executed?
I can specify the main class using . I suspect there's a similar attribute for JVM arguments. Specially I need to specify the maximum memory (example -Xmx500m).
Here's my assembly plugin:
maven-assembly-plugin
jar-with-dependencies
true
com.me.myApplication
Edit/Follow-up: It seems that it might not be possible to specify JVM arguments for an executable JAR according to this and this post.
解决方案
I don't know of any such mechanism. The JVM configuration is specified by the calling java command.
Here's the jar file specification which conspicuously doesn't mention any attribute other than Main-Class for stand-alone execution: