[GRADLE-2603] war plugin builds war even if test fails Created: 17/Dec/12  Updated: 14/Sep/16  Resolved: 14/Sep/16

Status: Resolved
Project: Gradle
Affects Version/s: 1.3
Fix Version/s: None

Type: Bug
Reporter: Jeff Storey Assignee: Unassigned
Resolution: Won't Fix Votes: 0


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.

Generated at Wed Jun 30 12:26:25 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.