Gradle JavaExec Task Type: Difference between revisions
Jump to navigation
Jump to search
(→main) |
No edit summary |
||
Line 12: | Line 12: | ||
<syntaxhighlight lang='groovy'> | <syntaxhighlight lang='groovy'> | ||
task someTask(type: JavaExec) { | task someTask(type: JavaExec) { | ||
classpath = configurations.runtimeClasspath | classpath = configurations.runtimeClasspath | ||
main = 'myPackage.MyMainClass' | main = 'myPackage.MyMainClass' | ||
args 'something somethingelse' | args 'something somethingelse' | ||
jvmArgs = ['-Xmx12g'] | |||
environment "LD_LIBRARY_PATH", "/usr/local/lib" | environment "LD_LIBRARY_PATH", "/usr/local/lib" | ||
systemProperties [ "some.prop": "some.value", "some.other.prop": "some.other.value" ] | systemProperties [ "some.prop": "some.value", "some.other.prop": "some.other.value" ] | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 31: | Line 30: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==<tt>main</tt>== | ==<tt>main</tt>== | ||
The main class. Must be available on classpath. | |||
<syntaxhighlight lang='groovy'> | |||
main = 'playground.javaExec.Main' | |||
</syntaxhighlight> | |||
==<tt>args</tt>== | ==<tt>args</tt>== | ||
Revision as of 19:39, 3 February 2021
External
- https://docs.gradle.org/current/dsl/org.gradle.api.tasks.JavaExec.html
- https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/JavaExec.html
- https://www.baeldung.com/gradle-run-java-main
Internal
Overview
Executes a Java application as a child process. To get details on the actual java command line, execute Gradle with -i command line option.
task someTask(type: JavaExec) {
classpath = configurations.runtimeClasspath
main = 'myPackage.MyMainClass'
args 'something somethingelse'
jvmArgs = ['-Xmx12g']
environment "LD_LIBRARY_PATH", "/usr/local/lib"
systemProperties [ "some.prop": "some.value", "some.other.prop": "some.other.value" ]
}
Configuration
classpath
classpath = sourceSets.main.runtimeClasspath
classpath = configurations.runtimeClasspath
main
The main class. Must be available on classpath.
main = 'playground.javaExec.Main'