Einen JavaExec-Task dynamisch loopen lassen:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
def myLib = "${buildDir}/dependencies/MyLib.jar" // ... tasks.register('myTask') {} someItems.each { anItem -> tasks.myTask.dependsOn tasks.register("handling-item-${anItem.id}", JavaExec) { // here goes whatever you want to configure: dependsOn tasks.someTask, tasks.someOtherTask classpath = files(myLib) javaLauncher.set(javaToolchains.launcherFor { languageVersion = JavaLanguageVersion.of(8) }) args = [ "-foo=${anItem.bar}", "-xxx=yyy", // ... ] } } |
someItems kann von irgendwo her kommen; aus einer eingelesenen Datei bspw.