I am using ant to distribute a set of folders for a web application. I am using a book called mySQL and jspIt is a zip file, which I unzip. the xml files I have to change are not read only - but the higher level files are and I have tried unchecking the read only attribute but is gets rechecked to read only. The build is the build file: Where I point to: c:\jakarta-tomcat-4.0.6\webapps\bfg\ ---------------------------------------------------------------- <project name="BfgWebsite" default="dist" basedir="."> <property name="tomcatdir" value="/tomcat"/> <property name="appdir" value="${tomcatdir}/webapps/bfg"/> <property name="jarfile" value="bfgclasses.jar"/> <target name="init"> <tstamp/> </target> <target name="compile" depends="init"> <javac srcdir="src"> <classpath> <pathelement path="${classpath}"/> <pathelement path="src"/> <fileset dir="c:\jakarta-tomcat-4.0.6\lib"> <include name="**/*.jar"/> </fileset> <fileset dir="c:\jakarta-tomcat-4.0.6\common"> <include name="**/*.jar"/> </fileset> <fileset dir="c:\jakarta-tomcat-4.0.6\webapps\bfg\WEB-INF\lib\"> <include name="**/*.jar"/> <exclude name="bfgclasses.jar"/> </fileset> </classpath> </javac> </target>
<web-app> <servlet> <servlet-name>log4j-init</servlet-name> <servlet-class>com.bfg.services.Log4jInit</servlet-class> <init-param> <param-name>log4j-init-file</param-name> <param-value>WEB-INF/log4j.properties</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet> <servlet-name>turbine-init</servlet-name> <servlet-class>com.bfg.services.TurbineInit</servlet-class> <init-param> <param-name>turbine-resource-directory</param-name> <param-value> c:/jakarta-tomcat-4.0.6/webapps/bfg/WEB-INF</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <session-config> <session-timeout>5</session-timeout> </session-config> <resource-ref> <res-ref-name>mail/session</res-ref-name> <res-type>javax.mail.Session</res-type> <res-auth>Container</res-auth> </resource-ref> </web-app> <param-value> c:\jakarta-tomcat-4.0.6/webapps/bfg/WEB-INF</param-value> again points to c:/jakarta-tomcat-4.0.6/webapps/bfg/ I run ant with the following and I get the below, I do not know why it creates C:\tomcat\webapps\bfg Not : c:\jakarta-tomcat-4.0.6\webapps\bfg --------------------------------- init: compile: dist: [mkdir] Created dir: C:\tomcat\webapps\bfg\WEB-INF\lib [mkdir] Created dir: C:\tomcat\webapps\bfg\logs [jar] Building jar: C:\tomcat\webapps\bfg\WEB-INF\lib\bfgclasses.jar [copy] Copying 3 files to C:\tomcat\webapps\bfg\WEB-INF [mkdir] Created dir: C:\tomcat\webapps\bfg\jsp [copy] Copying 35 files to C:\tomcat\webapps\bfg\jsp BUILD SUCCESSFUL Total time: 1 second C:\TEMP\cartapp\bfg> (this is where I have the xml and cartapp files) � temp /../ AM I doing something wrong with ant? I tried taking the read write off the files, but it will not stay off, but it is not on the xml files � would this make a difference? Not sure what else to try
Thomas Paul
mister krabs
Ranch Hand
Joined: May 05, 2000
Posts: 13974
posted
0
Look at these two properties from the beginning of the build file: <property name="tomcatdir" value="/tomcat"/> <property name="appdir" value="${tomcatdir}/webapps/bfg"/>
And then look at where your stuff is going. See the relationship? Look where you are creating the jar... <jar jarfile="${appdir}/WEB-INF/lib/${jarfile}">
I'm not sure what's going on with the read/write permissions, but your main question seems to be why stuff shows up in: C:\tomcat\webapps\bfg instead of c:\jakarta-tomcat-4.0.6\webapps\bfg. That has nothing to do with write permissions. It's because you define the appdir property to be ${tomcatdir}/webapps/bfg and the tomcatdir property to be /tomcat. I think Ant is just doing what you're telling it to do. Maybe I misunderstood the question though?
D'oh! What Tom said. I'm off to practice my speed typing.
mary morris
Ranch Hand
Joined: Mar 16, 2002
Posts: 97
posted
0
Thanks for the help - is this what you meant Thomas? -Now I get a different error message when run ant -------------- C:\>cd\temp\cartapp\bfg C:\TEMP\CARTAPP\bfg>ant dist Buildfile: build.xml init: compile: BUILD FAILED C:\TEMP\CARTAPP\bfg\build.xml:11: srcdir "C:\TEMP\CARTAPP\bfg\src" does not exist! -------------------- this is the build file ----------------------- <project name="BfgWebsite" default="dist" basedir="."> <property name="C:\jakarta-tomcat-4.0.6" value="/tomcat"/> <property name="appdir" value="${tomcatdir}/webapps/bfg"/> <property name="jarfile" value="bfgclasses.jar"/> <target name="init"> <tstamp/> </target> <target name="compile" depends="init"> <javac srcdir="src"> <classpath> <pathelement path="${classpath}"/> <pathelement path="src"/> <fileset dir="c:\tomcat\lib"> <include name="**/*.jar"/> </fileset> <fileset dir="c:\tomcat\common"> <include name="**/*.jar"/> </fileset> <fileset dir="c:\tomcat\webapps\bfg\WEB-INF\lib\"> <include name="**/*.jar"/> <exclude name="bfgclasses.jar"/> </fileset> </classpath> </javac> </target>