I would like to include a set of resource files to my war file.
I know that I can specify either fileset or webinf as an inner element of my war element in build.xml, but in both of these cases, when I deploy the war file, the resource files end up in either top level directory or WEB-INF directory respectively.
I would like to place them into a subdirectory (say, WEB-INF/resources). Actually, these resource files are in a subdirectory in my source three already, I just need to include this subdirectory as is to the war file.
How is this done?
You can use zipfileset with prefix attribute to add a subdirectory to zip/war file. If the resource files is in src/resource, and you want to pack them into WEB-INF/resource. Here is the example:
<target name="build">
<war destfile="test.war">
<fileset dir="webapps">
<include name="**" />
</fileset>
<zipfileset dir="src/resource" prefix="WEB-INF/resource" />
</war>
</target>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With