You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Xa...@dresdnerkb.com on 2000/05/30 15:44:27 UTC

Newbie question

Hi All,

Can the XML build file be written in a more parametric fashion, whereby you
separate the dependency description from the execution instructions?  The
reason I ask is that the build file seems very declarative (which has its
positive points), but things can become pretty verbose in large scale
projects.  Could you parameterise a target in such a way as to create a more
reusable set of build process instructions?  For example, create a beanMaker
target that complies some bean classes, generates the serialized descriptor,
generates container classes, but can be completely reused.

Many thanks for any replies.

regards,
Zav

Xavier Witdouck

Dresdner Kleinwort Benson
Direct: +44 (0)171 475 1265
Mobile: +44 (0)777 568 5977
E-mail: xavier.witdouck@dresdnerkb.com



--------------------------------------------------------------------------------
This email and any files transmitted with it are intended solely for the
addressee(s) and may be legally privileged and/or confidential. If you have
received this email in error please destroy it and contact the sender, via
our switchboard on +44 (0)20 7623 8000 or via return e-mail. You should not
copy, forward or use the contents, attachments or information in any way.
Any unauthorised use or disclosure may be unlawful. Dresdner Kleinwort
Benson gives no warranty as to the accuracy or completeness of this email
after it is sent over the Internet and accepts no responsibility for changes
made after it was sent. Any opinion expressed in this email may be personal
to the author and may not necessarily reflect the opinions of the Bank or
its affiliates. They may also be subject to change without notice.
--------------------------------------------------------------------------------

Re: Newbie question

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "XW" == Xavier Witdouck <Xa...@dresdnerkb.com> writes:

 XW> For example, create a beanMaker target that complies some bean
 XW> classes, generates the serialized descriptor, generates container
 XW> classes, but can be completely reused.

The idea I first came up with won't work with the current
implementation of the <property> tag but should work sometime in the
future (as this implementation is bound to change). I will describe a
workaround later on.

1. Generate an Ant project file with the beanMaker target - and all
the other targets that are needed.

2. Make all the tasks inside the beanMaker file use Ant properties for
the variable parts along the lines of

<javac>
    <include name="$files.for.bean" />
</javac>

3. In your main Project set the properties correctly and call an ant
task on the other file.

Unfortunately this won't work as properties are set by the parser and
you will always end up with the last value specified for a given
property - each time you use it.

The workaround is to use an exec task to invoke another Ant instance
or a java task on org.apache.tools.ant.Main and specify the intended
properties as command line arguments (the -Dproperty=value option).

Haven't tried it but this should work

        Stefan