It there any way to avoid duplication in configuration between two similar tasks of the same type?
For example, I\'d like to create a debugSomething
task, w
I've found that using the Task.configure
method is very helpful for centralizing logic like this.
I haven't tested it, but in your case this might look like this:
def commonSomething = {
main = "com.some.Main"
classpath = sourceSets.main.runtimeClasspath
jvmArgs "-Xmx1024m", "-XX:MaxPermSize=128m"
}
task runSomething(dependsOn: jar, type: JavaExec, group: "Run") {
configure commonSomething
}
task debugSomething(dependsOn: jar, type: JavaExec, group: "Run") {
configure commonSomething
jvmArgs ...add debug arguments...
}