I have a packaged app.war file that I am trying to copy to the webapps folder and I am getting an error:
BUILD FAILED
Failed to copy mywar.war to /usr/local/tomcat/webapps/mywar.war due to java.io.FileNotFoundException /usr/local/tomcat/webapps/mywar.war (Permission denied)
Here is the ant code for this:
<target name="install" depends="package">
<copy file="mywar.war" tofile="${webapp.dir}/mywar.war" overwrite="true" />
</target>
It is obviously a permissions thing. I can not really solve it by chmod 777 the .war file because the myapp.war will get erased every time, and the new files will have the restrictive permissions applied again.
What if I make the whole webapps dir permissions 777 or something? That seems like bad practice in terms of security, right? Or is there an ant command to give the script root permission? I am using ubuntu if it matters.
thanks!
Personally, I build the WAR file with Ant, and then
suto root and copy it to thewebappsfolder by hand.However, you could make the
webappsfolder writable by a particular group, and run Ant as a member of that group.