Hi all,
I have written my own task. Here's how a section of my build.xml might look:
<path id="my.classpath">
<dirset dir="WEB-INF/classes"/>
<fileset dir="WEB-INF/lib" includes="*.jar"/>
</path>
<taskdef name="my-chown" classname="com.blah.ant.ChangeOwnershipTask" classpathref="my.classpath"/>
<taskdef name="my-chmod" classname="com.blah.ant.ChangePermissionsTask" classpathref="my.classpath"/>
<target name="mytarget">
<property name="my.config" value="file:WEB-INF/config/my.properties"/>
<my-chown classpathref="my.classpath"
config="${fdx.config}"
name="/dir/foo.xml"/>
ownerName="user1"/>
</target>The task itself is stored in a different lib directory, not on Ant's own classpath. Now, this works, but it feels a bit clumsy. I therefore have two questions:
1) Every time I use my task, I have to pass the task the classpath definition, as the task needs to create a new classloader with which to run my application. Is there a way to remove the necessity to mention the classpath, deriving it from the one used within the <taskdef>?
2) The application that the task is invoking requires a system property to be set. So my task takes in a property 'config', and sets the system property before invoking the application. But again, this needs to be done every time. Is there (a) a way to set a system property once that will effect all tasks or (b) would someone recommend a specific way to provide this configuration just once, e.g. set a property, and have the task always look for a property of that name. Is there a convention here?
Thanks for any help you can provide.
Regards, Upayavira
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
