Return-Path: Delivered-To: apmail-jakarta-ant-dev-archive@apache.org Received: (qmail 85469 invoked from network); 6 Mar 2002 14:47:38 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 6 Mar 2002 14:47:38 -0000 Received: (qmail 2221 invoked by uid 97); 6 Mar 2002 14:47:36 -0000 Delivered-To: qmlist-jakarta-archive-ant-dev@jakarta.apache.org Received: (qmail 2205 invoked by uid 97); 6 Mar 2002 14:47:36 -0000 Mailing-List: contact ant-dev-help@jakarta.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 ant-dev@jakarta.apache.org Received: (qmail 2193 invoked from network); 6 Mar 2002 14:47:35 -0000 Message-ID: <012301c1c51d$d5b029a0$6401a8c0@darden.virginia.edu> From: "Erik Hatcher" To: "Ant Developers List" References: <20020305142710.15264.qmail@icarus.apache.org> <3C84D88F.6020109@cortexebusiness.com.au> <006d01c1c454$4c6e2b70$270610ac@manu.com> <3C862974.62424268@i2.com> Subject: Re: Probably dumb question about accessing system properties in build listeners. Date: Wed, 6 Mar 2002 09:47:26 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Are you grabbing them in buildStarted? (Un?)fortunately the Ant properties have not been set then. You will have to grab them during another event (lazy initialize in the first event where you need the property other than buildStarted, and cache whatever you need from buildStarted until then). Although System.getProperty should work, I'd think, although I've not tried it. That would mean you'd have to set them on the command-line rather than within a build file, but that seems ok for your needs at least. Erik ----- Original Message ----- From: "Ken Wood" To: "Ant Developers List" Sent: Wednesday, March 06, 2002 9:36 AM Subject: Probably dumb question about accessing system properties in build listeners. > I wrote a simple build listener, > and I initially designed it to be configured > from a file. Now, I want it to be configured > from system properties on the command line. > > So, I changed the code that reads the property > files to instead us java.lang.System.getProperty()... > When I invoke Ant, I used the -Dproperty=value syntax. > > Well, when I test the listener, the properties are not > there! I suspect Ant is grabbing them because I see that > Project has getProperty methods. Problem is, I can't > see a way to get a handle on the project object in > a build listener. Everything else I looked at that > references a project object is extended from Project > in one way or another, so the access is easy. > > Am I missing something? Is there some way for a build > listener to get the 'project' object so it can > get the properties? Any advice on how I should do this? > Or, should System.getProperty work??? > > Thanks! > > -ken > > -- > To unsubscribe, e-mail: > For additional commands, e-mail: > > -- To unsubscribe, e-mail: For additional commands, e-mail: