Hi
In my build script, I have the following task which executes a java application:
task myTask(type: JavaExec) {
classpath sourceSets.main.runtimeClasspath
main = "com.company.MyClass"
args System.getProperty("exec.args", "").split()
}
Now, I try to execute ‘clean’, ‘myTask’ and ‘build’ in this order in another task as follows:
task buildAll(dependsOn: ['clean', 'myTask', 'build']) {
}
myTask.mustRunAfter clean
build.mustRunAfter myTask (which gradle tells cannot resolve mustRunAfter, so I cannot use this command, am I right?)
When I run buildAll task, gradle executes clean, compileJava, processResources, classes, myTask, war, assemble, compileTestJava, processTestResources, testClasses, test, check, build. Now the problem is that myTask updates a resource file which should be included in final war file but because processResources is executed before myTask, the old file gets copied into war file. I got two questions:
1-Why compileJava, processResources and classes tasks are executed before myTask?
2-How could I force grade to execute processTestResources after executing myTask?
I am using gradle 3.0 and JDK 1.8.0_66 x64
Regards,
Ferez