diff --git a/docs/index.html b/docs/index.html
index 2fbd41437..7c7e696de 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -382,7 +382,7 @@ name of the operating system.
In addition Ant knows some built in properties:
- basedir - the absolute path of the project's basedir (as set
- with the basedir attribute of <project>.
+ with the basedir attribute of <project>).
- ant.file - the absolute path of the build file.
- ant.java.version - the JVM version Ant detected. Currently it
can hold the values "1.1", "1.2" and
@@ -3094,6 +3094,13 @@ instead.
1.2 |
No |
+
+ failonerror |
+ Stop the buildprocess if the command exits with a
+ returncode other than 0. |
+ all |
+ No |
+
Parameters specified as nested elements
diff --git a/src/main/org/apache/tools/ant/taskdefs/ExecTask.java b/src/main/org/apache/tools/ant/taskdefs/ExecTask.java
index a15e0ae72..f91582da3 100644
--- a/src/main/org/apache/tools/ant/taskdefs/ExecTask.java
+++ b/src/main/org/apache/tools/ant/taskdefs/ExecTask.java
@@ -65,7 +65,7 @@ import java.io.*;
* @author duncan@x180.com
* @author rubys@us.ibm.com
* @author thomas.haas@softwired-inc.com
- * @author Stefan Bodewig
+ * @author Stefan Bodewig
* @author Mariusz Nowostawski
*/
public class ExecTask extends Task {
diff --git a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
index d3ce89099..ace5e9a70 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
@@ -90,6 +90,7 @@ import java.util.*;
* @author Stefano Mazzocchi stefano@apache.org
* @author Patrick Chanezon chanezon@netscape.com
* @author Ernst de Haan ernst@jollem.com
+ * @author Stefan Bodewig
*/
public class Javadoc extends Task {
@@ -191,6 +192,7 @@ public class Javadoc extends Task {
}
private boolean foundJavaFile = false;
+ private boolean failOnError = false;
private Path sourcePath = null;
private File destDir = null;
private String sourceFiles = null;
@@ -543,6 +545,16 @@ public class Javadoc extends Task {
}
}
+ /**
+ * Should the build process fail if javadoc fails (as indicated by
+ * a non zero return code)?
+ *
+ * Default is false.
+ */
+ public void setFailonerror(boolean b) {
+ failOnError = b;
+ }
+
public void execute() throws BuildException {
if ("javadoc2".equals(taskType)) {
log("!! javadoc2 is deprecated. Use javadoc instead. !!");
@@ -726,7 +738,10 @@ public class Javadoc extends Task {
exe.setWorkingDirectory(project.getBaseDir());
try {
exe.setCommandline(toExecute.getCommandline());
- exe.execute();
+ int ret = exe.execute();
+ if (ret != 0 && failOnError) {
+ throw new BuildException("Javadoc returned "+ret, location);
+ }
} catch (IOException e) {
throw new BuildException("Javadoc failed: " + e, e, location);
} finally {