ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ceki Gülcü <>
Subject Attempt at "if-like" task
Date Wed, 29 Aug 2001 22:19:29 GMT


I recently came across Jython. As a short *exercise*, I decided to add a
"if-like" task to Ant using Python as the underlying expression
language. Example code is provided as an attachment.

Why Python? Python is a pretty cool scripting language. More
importantly, using Jython it is very easy to cross the Java/Python
language barrier. is a very small task that illustrates the manipulation
of ant project properties using arbitrary Python expressions. Note
that IfPython is just a normal task. There is no need to change the ANT
architecture to accommodate complex boolean expressions.

The idea is to use the powerful Python interpreter to evaluate complex
expressions and return the results in the form of project
properties. These project properties can then be used to control the
execution of ANT targets.

In addition to ANT, you will need jython ( to
compile and execute the example code (written in Java and Python).

The code is intended as proof of concept with no pretension at
reusability or reliability. Regards, Ceki

ps: I apologize in advance if this is all redundant/boring stuff that
has been proposed a million times in the past. 

ps: If the attachment fails, you can get the code at

Ceki Gülcü -

View raw message