开发者

Files inside WAR appear double

I'm using ANT to build the WAR file for my Java web app. However, when I look inside the WAR file I see every file appear twice (not the folders, just the files). When I extract the WAR file there are no errors and the file structure appears to be correct, no double files. If I then compess the extracted file back into a ZIP file the archive is almost exactly half the size in byte开发者_Python百科s of the original WAR file created by ANT.

I'm using the following task to create my WAR file:

<target name="dist" depends="package">          
    <war destfile="${bin.dir}/webapp.war" basedir="${tmp.dir}">
        <fileset dir="${tmp.dir}" />
    </war>
</target>

When I inspect the file structure in the tmp.dir the files seem to appear OK. I'm running ANT from within Eclipse (Helios) on Ubuntu 9.10.


I found out what caused the problem. The <fileset> tag inside the <war> task is somehow causing the files to be added to the archive twice. It would be good if ANT would throw up an error but it didn't. Since I want to add the entire tmp.dir to my archive, I should have used to following:

<target name="dist" depends="package">          
    <war destfile="${bin.dir}/webapp.war" basedir="${tmp.dir}">
        <!-- No extra <fileset> -->
    </war>
</target>

In case someone else comes across this problem, I leave this question here rather than deleting it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜