More Java posts
January 21, 2003
Ant addon
A little addon I developed for ant. It's an implementation of the org.apache.tools.ant.util.FileNameMapper interface that takes a .java file and returns the name the file should have based on its package statement. I needed it when I was generating code using the ant style task. All of the .xml files were in one single directory but the generated code had to go into multiple different directories depending on the package. After generating to a single output directory an ant move task was used like this example.
<move todir="${basedir}/src">
<mapper classname="com.zanthan.ant.PackageFileMapper"
to="" from="${basedir}/generated"/>
<fileset dir="${basedir}/generated">
<include name="*AutoGen.java"/>
</fileset>
</move>
Here's the source code. It's so simple I don't think I need to post the supporting stuff needed to compile it.
Posted by Alex at January 21, 2003 09:41 PMComments
Post a comment