BAEL-4371: Simplified examples

This commit is contained in:
Sorin Zamfir 2020-09-03 15:46:48 +03:00
parent d19ac51aaa
commit 1d5b20e705
1 changed files with 7 additions and 15 deletions

View File

@ -10,21 +10,17 @@ application {
task propertyTypes(){ task propertyTypes(){
doLast{ doLast{
project.getProperties().values().each { if (project.hasProperty("args")) {
println "Project property ["+it+"]" println "Our input argument with project property ["+project.getProperty("args")+"]"
}
System.getProperties().each {
println "System property ["+it+"]"
} }
println "Our input argument with system property ["+System.getProperty("args")+"]"
} }
} }
if (project.hasProperty("args")) { if (project.hasProperty("args")) {
ext.cmdargs = project.getProperty("args") ext.cmdargs = project.getProperty("args")
ext.cmdargsarray = cmdargs.split()
} else { } else {
ext.cmdargs = "" ext.cmdargs = "ls"
} }
task cmdLineJavaExec(type: JavaExec) { task cmdLineJavaExec(type: JavaExec) {
@ -32,15 +28,11 @@ task cmdLineJavaExec(type: JavaExec) {
description = "Run the main class with JavaExecTask" description = "Run the main class with JavaExecTask"
classpath = sourceSets.main.runtimeClasspath classpath = sourceSets.main.runtimeClasspath
main = javaMainClass main = javaMainClass
args cmdargsarray args cmdargs.split()
} }
ext.cmdarray = ["java", "-classpath", sourceSets.main.runtimeClasspath.getAsPath(), javaMainClass]
cmdarray = (cmdarray << cmdargsarray).flatten()
task cmdLineExec(type: Exec) { task cmdLineExec(type: Exec) {
dependsOn build
group = "Execution" group = "Execution"
description = "Run the main class with ExecTask" description = "Run the an external program with ExecTask"
commandLine cmdarray commandLine cmdargs.split()
} }