[ACCEPTED]-adding non-code resources to jar file using Ant-jar
You shouldn't have an includesfile
attribute in a target to 12 start with, and I suspect you've misunderstood 11 the point of it anyway - the idea is that 10 the file you specify with includesfile
contains patterns 9 for which files to include, if you don't 8 want to put them into your Ant file.
It strikes 7 me that all you need is an extra fileset 6 containing the appropriate files you need. For 5 example, for readthis.txt
:
<target name="distribute" depends="compile">
<jar destfile="${distributionDir}/myjar.jar" >
<fileset dir="${outputDir}"/>
<fileset dir="${sourceDir}"/>
<fileset file="readthis.txt" />
</jar>
</target>
I would also suggest that 4 you create a new directory for the resources, so 3 you can do:
<target name="distribute" depends="compile">
<jar destfile="${distributionDir}/myjar.jar" >
<fileset dir="${outputDir}"/>
<fileset dir="${sourceDir}"/>
<fileset dir="${resourcesDir}" />
</jar>
</target>
with no hassle. This will also 2 keep your directory structure cleaner, making 1 it easier to find things from the top downwards.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.