Hello,
How do I add a dependsOn dependency to a task contained in the Java plugin, such as compileTestJava or compileJava?
Thanks.
Hello,
How do I add a dependsOn dependency to a task contained in the Java plugin, such as compileTestJava or compileJava?
Thanks.
Hello,
Gradle provides two ways to configure given tasks and it doesn’t matter where those tasks come from. you can use this notation:
compileJava.dependsOn anotherTask
or if you can use this syntax:
compileJava{
dependsOn anotherTask
}
The userguide has more details about that at http://gradle.org/docs/current/userguide/userguide_single.html#configureUsingVar
regards, René
Thank you.
but
sonar.dependsOn test
gives:
Executing command: “tasks”
FAILURE: Build failed with an exception.
Where: Script ‘E:\workspaces_old\SaaS2\orchestration\sonar.gradle’ line: 4
What went wrong: A problem occurred evaluating script. > Could not find method dependsOn() for arguments [task ‘:test’] on root project ‘orchestration’.
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
If you’re using the sonar plugin shipped with gradle, “sonar” is an extension to the project and not a task. The sonar task is “sonarAnalyze” so
sonarAnalyze.dependsOn test
is the way to go for you.
ok thank you, my mistake is I use a command gradle sonar but it actually runs sonarAnalyze task