Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 96599 invoked from network); 16 Oct 2003 17:05:02 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 16 Oct 2003 17:05:02 -0000 Received: (qmail 70231 invoked by uid 500); 16 Oct 2003 17:04:52 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 70034 invoked by uid 500); 16 Oct 2003 17:04:51 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 70002 invoked by uid 500); 16 Oct 2003 17:04:51 -0000 Received: (qmail 69985 invoked from network); 16 Oct 2003 17:04:50 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 16 Oct 2003 17:04:50 -0000 Received: (qmail 96519 invoked by uid 1539); 16 Oct 2003 17:04:58 -0000 Date: 16 Oct 2003 17:04:58 -0000 Message-ID: <20031016170458.96518.qmail@minotaur.apache.org> From: peterreilly@apache.org To: ant-cvs@apache.org Subject: cvs commit: ant/docs/manual/CoreTasks import.html X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N peterreilly 2003/10/16 10:04:58 Modified: src/main/org/apache/tools/ant/taskdefs Tag: ANT_16_BRANCH ImportTask.java docs/manual/CoreTasks Tag: ANT_16_BRANCH import.html Log: merge with HEAD Revision Changes Path No revision No revision 1.16.2.1 +20 -5 ant/src/main/org/apache/tools/ant/taskdefs/ImportTask.java Index: ImportTask.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/ImportTask.java,v retrieving revision 1.16 retrieving revision 1.16.2.1 diff -u -r1.16 -r1.16.2.1 --- ImportTask.java 19 Sep 2003 09:36:22 -0000 1.16 +++ ImportTask.java 16 Oct 2003 17:04:57 -0000 1.16.2.1 @@ -64,8 +64,6 @@ import java.util.Vector; /** - * EXPERIMENTAL: This task is experimental and may be under continual - * change till Ant1.6 ships; it may even be omitted from the product. *

* Task to import another build file into the current project. *

@@ -96,8 +94,19 @@ */ public class ImportTask extends Task { private String file; + private boolean optional; /** + * sets the optional attribute + * + * @param optional if true ignore files that are not present, + * default is false + */ + public void setOptional(boolean optional) { + this.optional = true; + } + + /** * the name of the file to import. How relative paths are resolved is still * in flux: use absolute paths for safety. * @param file the name of the file @@ -151,9 +160,15 @@ } if (!importedFile.exists()) { - throw new BuildException( - "Cannot find " + file + " imported from " - + buildFile.getAbsolutePath()); + String message = + "Cannot find " + file + " imported from " + + buildFile.getAbsolutePath(); + if (optional) { + getProject().log(message, Project.MSG_VERBOSE); + return; + } else { + throw new BuildException(message); + } } importedFile = new File(getPath(importedFile)); No revision No revision 1.6.2.2 +9 -0 ant/docs/manual/CoreTasks/import.html Index: import.html =================================================================== RCS file: /home/cvs/ant/docs/manual/CoreTasks/import.html,v retrieving revision 1.6.2.1 retrieving revision 1.6.2.2 diff -u -r1.6.2.1 -r1.6.2.2 --- import.html 9 Oct 2003 21:01:07 -0000 1.6.2.1 +++ import.html 16 Oct 2003 17:04:58 -0000 1.6.2.2 @@ -84,6 +84,15 @@ Yes + + optional
+ + + if true, do not issue stop the build if the file does not exist, + default is false.
+ + No +


--------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org