コード例 #1
0
  @Test
  public void javadocGenerationFailureBreaksBuild() throws IOException {
    TestFile buildFile = testFile("javadocs.gradle");
    buildFile.write("apply plugin: 'java'");
    testFile("src/main/java/org/gradle/broken.java").write("class Broken { }");

    ExecutionFailure failure = usingBuildFile(buildFile).withTasks("javadoc").runWithFailure();

    failure.assertHasFileName(String.format("Build file '%s'", buildFile));
    failure.assertHasDescription("Execution failed for task ':javadoc'");
    failure.assertHasCause("Javadoc generation failed.");
  }
コード例 #2
0
  @Test
  public void compilationFailureBreaksBuild() {
    TestFile buildFile = testFile("build.gradle");
    buildFile.writelns("apply plugin: 'java'");
    testFile("src/main/java/org/gradle/broken.java").write("broken");

    ExecutionFailure failure = usingBuildFile(buildFile).withTasks("build").runWithFailure();

    failure.assertHasFileName(String.format("Build file '%s'", buildFile));
    failure.assertHasDescription("Execution failed for task ':compileJava'");
    failure.assertHasCause("Compile failed; see the compiler error output for details.");
  }