There are a few ways to get around this.
When using the JAR task, use the chmod task directly afterwards to set the permissions. The chmod task does does not work correctly in Windows, but will work correctly in UNIX.. go figure.
<!-- Jars all class files in parent directory and then sets the jar file to rwxr-xr-x permissions -->
<jar destfile="myjar.jar">
<fileset dir="./" includes="**/*.class" />
</jar>
<chmod file="myjar.jar" perm="755">
When using the WAR task, the same is true. However, I am using a zipfileset below, which extends the fileset element, but allows the user to set permissions on the files within the fileset. In this case, I had to set all jars to 755 in order for them to be executable for an applet. First, I had to exclude all jars from the war element. Next, include them in the zipfileset, setting the filemode, or file permissions, to 755, or rwxr-xr-x. Example:
<war destfile="mywar.war" manifest="manifest.mf" basedir="./" excludes="**/*.jar">
<zipfileset dir="." includes="**/*.jar" filemod="755"/>
</war>
One more thing to note: I've read in other blogs that the chmod element tends to work erratically in Windows due to security flaws. You may want to envelope the chmod in an ant target that depends on the OS like in the example below:
<!-- Calls chmod if the OS is NOT a Windows Operating System -->
<condition value="isWindows">
<os family="windows"/>
</condition>
<target name="chmodFile" unless="isWindows">
<chmod file="myjar.jar" perm="755" />
</target>
<antcall target="chmodFile" />
No comments:
Post a Comment