Hello, I have several jar (and war) tasks like this:
<jar destfile="${global_lib}/${ws_aar}" filesonly="yes"> <fileset dir="${build.server}" includes="**/*.class"/> </jar> These are pretty basic and they work fine. However in some of my build situations, the destfile isn't a real file but a symbolic link. In those situations I need to break the symlink (causing a new file to be created), rather than "updating" the symlink (which would cause the target of the link to be updated). Normally I would do this by removing the destfile (whether it's a symlink or a regular file) before recreating it. But I'm not seeing a nice way to do this with Ant. I tried using the update parameter: <jar destfile="${global_lib}/${ws_aar}" filesonly="yes" update="true"> <fileset dir="${build.server}" includes="**/*.class"/> </jar> but this doesn't break the symlink. Adding a delete task before the jar task isn't correct, because it will cause the destfile to always be deleted -- I only want to delete it when the jar task actually creates the destfile (and not when it determines that the destfile is up-to-date with respect to the includes). The only solution I've found is to use a dependset task before the jar task: <dependset> <srcfileset dir = "${build.server}" includes = "**/*.class" /> <targetfilelist dir = "${global_lib}" files = "${ws_aar}" /> </dependset> <jar destfile="${global_lib}/${ws_aar}" filesonly="yes"> <fileset dir="${build.server}" includes="**/*.class"/> </jar> This works, but it seems messy because it requires duplication of the fileset info and the name of the target file. I'm hoping there's some other way to accomplish this. I thought about extending the jar task and adding a new "delete-before-create" parameter, so that I could do something like this: <myjar destfile="${global_lib}/${ws_aar}" filesonly="yes" delete-before-create="true"> <fileset dir="${build.server}" includes="**/*.class"/> </myjar> This would be the nicest solution, but I'm not sure if it's possible to extend the jar task like this -- the extension docs I've read seem to only talk about creating new tasks, not extending existing tasks like jar/war. Any thoughts would be appreciated. Thanks! -Jason --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional commands, e-mail: user-h...@ant.apache.org