Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 38889 invoked from network); 18 Oct 2010 13:05:13 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 18 Oct 2010 13:05:13 -0000 Received: (qmail 10042 invoked by uid 500); 18 Oct 2010 13:05:12 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 9899 invoked by uid 500); 18 Oct 2010 13:05:10 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 9891 invoked by uid 99); 18 Oct 2010 13:05:09 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Oct 2010 13:05:09 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of qazwart@gmail.com designates 209.85.216.45 as permitted sender) Received: from [209.85.216.45] (HELO mail-qw0-f45.google.com) (209.85.216.45) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Oct 2010 13:05:01 +0000 Received: by qwh5 with SMTP id 5so571809qwh.4 for ; Mon, 18 Oct 2010 06:04:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=F2q3Cf08ixk518K2ibMQkQhDnw9URkHzFYZZQ5jVxgk=; b=GFpkRlmaj+cRULfJyFD6/Xw81+pEvzNvKMG+TS3ioRBYNfRSDh97iQvryeVgJpR9+4 A6+Me1kaHLuN/I/iXYCB2N6n8OPYWbixjU+L+/RXowTgl33C1qSXSZ9hg+4mnYbiOaA1 jlqhJXiPPxdY3b/ZqkDIL5QnyUxtw5iVA7w/Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=U73yYw6jQj7Phj34UcninvLbxBVy+bsC+2YWy+veT6h0HOO5t58GNT3nIt6Uk6XwvZ 2PK2WKODZPKnZ58POFK/VIi3CZ5elFA9TNJQtTJNUs0nYxEP789pTEUBBJphT3wm6xwV cd5fxSZpFyqvFan++UanwoOZHh4OSd+w1mzbc= MIME-Version: 1.0 Received: by 10.229.189.207 with SMTP id df15mr3834905qcb.299.1287407080334; Mon, 18 Oct 2010 06:04:40 -0700 (PDT) Received: by 10.229.231.82 with HTTP; Mon, 18 Oct 2010 06:04:40 -0700 (PDT) In-Reply-To: <1287082839192-3212639.post@n5.nabble.com> References: <1287082839192-3212639.post@n5.nabble.com> Date: Mon, 18 Oct 2010 09:04:40 -0400 Message-ID: Subject: Re: Way to not hard-code these values? From: David Weintraub To: Ant Users List Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org There are several ways to do just this. 1. Use the -D option to define the properties you want. 2. Use the -propertyfile flag to specify a property file 3. Use the field to specify which properties are stored in a particular file. If possible, you can define default values for the properties you want, and then over ride them via these other methods. For example, if you use #1 the values specified will override the default values in your build.xml file, you have the following: [...] And you put this on the command line: $ ant -Dhost=5.6.7.8 -Dport=5678 host will be set to "5.6.7.8" and not "1.2.3.4". And, port will be set to 5678 and not 1234. You can put a bunch of files into a properties file in the form of: host=5.6.7.8 port=5678 and that too will override the properties you've set with statements. I prefer to do something like this: This allows someone to use a default properties file or to override the default one on the command line via the -D option. My preference is to use default values in the build.xml and allow the user to override them on the command line. This meshes with my philosophy that a developer just typing "ant" on the command line will do more or less what they expect. If you don't specify default values, you should use tasks to fail the build when particular values are not set by the use via the command line: -- David Weintraub qazwart@gmail.com --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org