[GRADLE-2603] war plugin builds war even if test fails Created: 17/Dec/12 Updated: 14/Sep/16 Resolved: 14/Sep/16
The war plugin builds the war before running the tests. This results in a war being built even if the tests fail. This is bad as it could lead to an incorrectly functioning war file being built.
You can run gradle test build as a workaround.
|Comment by Adam Murdoch [ 26/Dec/12 ]|
We're unlikely to change this, as sometimes it's desirable to build the war without running the tests or if the tests fail.
If you'd like the war not to be built if the tests fail, you can add 'war.dependsOn test' in your build script.
|Comment by Jeff Storey [ 27/Dec/12 ]|
We currently have the war depending on the test, and that does work. I thought that would be the logical default that you can override if you want. This way you would need to explicitly tell gradle to build the war even if the tests don't pass since that would be the exceptional case, rather than the other way around.