Have you considered <macrodef>?
Look at the example <macrodef name="call-cc"> You will see a
<cc-elements> child... I think this is what you are wanting to do...
Vitaliy S wrote:
Hello Ben,
I want to let users to change content of task in my ant file but don't
want
to let them change the file it self.
e.g.
<project name="myproject" basedir=".">
<target name="mytarget">
<copy todir="../dest/dir">
<fileset dir="src_dir">
<exclude name="/*.java"/>
</fileset>
<!--begin of mutable content -->
<fileset dir="other_src__dir">
<exclude name="**/*.java"/>
</fileset>
<!--end of mutable content -->
</copy>
</target>
</project>
In the example above mutable part can not be extracted as seporate
task of other ant file.
(in actual example it is hibernate hbm files include for xdoclet).
I want to find clean solution to include xml code for subtasks from a
different files to my build file.
Thanks for your replay.
Regards,
Vitaliy S
On 6/17/06, Ben Stringer <[EMAIL PROTECTED]> wrote:
On Fri, 2006-06-16 at 18:54 +0300, Vitaliy S wrote:
> Hello,
>
> I have target with a task supporting subtasks
> e.g
>
> <copy todir="../dest/dir">
> <!--begin of mutable content -->
> <fileset dir="src_dir">
> <exclude name="**/*.java"/>
> </fileset>
> <!--end of mutable content -->
> </copy>
> the content of task may be changed but the rest file is immutable.
> I want to store mutable content in seporate file.
> What is the best way to do it?
Hi Vitaliy,
I'm not sure I understand your requirement, but if you are saying that
the XML describing the task will change from build to build, and you
need to use it, then I'd suggest using <import> to import the mutable
part of the task, then having the immutable part of the task call the
mutable part using <antcall>.
Eg.
mutable.xml:
<project name="mutable" basedir=".">
<target name="mutable.part">
<echo>I change from build to build</echo>
</target>
</project>
build.xml:
<project name="build" basedir=".">
<import file="mutable.xml"/>
<target name="immutable.part">
<echo>I never change from build to build</echo>
<antcall target="mutable.part"/>
<echo>I also never change</echo>
</target>
</project>
If the mutable part changes _during_ build time, this gets trickier,
although it still should be possible to get working, by using the <ant>
task to re-import the mutable file.
But not fully understanding what you are after, I may be way off here :)
Cheers, Ben
>
>
> Regards,
> Vitaliy S
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Scot P. Floess
27 Lake Royale
Louisburg, NC 27549
252-478-8087 (Home)
919-754-4592 (Work)
Chief Architect JPlate http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]