I want to use maven-exec-plugin to run my class.
class ThisTestLauncher {
public static void main(String[] args) throws Exception {
System.out.println(
ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getMax()
);
}
pom:
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<mainClass>com.my.ThisTestLauncher</mainClass>
<arguments>
<argument>-Xms512m</argument>
<argument>-Xmx2g</argument>
</arguments>
</configuration>
Still, I see output to be 259522560, that's like 256m size. The same result for
<commandlineArgs>-Xms512m -Xmx2g</commandlineArgs>
What's wrong with it?
<commandlineArgs>
and <arguments>
are passed to the main method. They are no JVM arguments.
As an alternative, use goal exec:exec
and specify java -Xmx512m -Xmx2g com.my.ThisTestLauncher
as your command to execute. See http://www.mojohaus.org/exec-maven-plugin/exec-mojo.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With