java - Modify build.xml for another path for tomcat -
this should easy, i'm stuck trying modify build.xml i'm getting tutorial. see below:
<?xml version="1.0"?> <project name="springapp" basedir="." default="usage"> <property file="build.properties"/> <property name="src.dir" value="src"/> <property name="web.dir" value="war"/> <property name="build.dir" value="${web.dir}/web-inf/classes"/> <property name="name" value="springapp"/> <path id="master-classpath"> <fileset dir="${web.dir}/web-inf/lib"> <include name="*.jar"/> </fileset> <!-- need servlet api classes: --> <!-- * tomcat 5/6 use servlet-api.jar --> <!-- * other app servers - check docs --> <fileset dir="${appserver.lib}"> <include name="servlet*.jar"/> </fileset> <pathelement path="${build.dir}"/> </path> <target name="usage"> <echo message=""/> <echo message="${name} build file"/> <echo message="-----------------------------------"/> <echo message=""/> <echo message="available targets are:"/> <echo message=""/> <echo message="build --> build application"/> <echo message="deploy --> deploy application directory"/> <echo message="deploywar --> deploy application war file"/> <echo message="install --> install application in tomcat"/> <echo message="reload --> reload application in tomcat"/> <echo message="start --> start tomcat application"/> <echo message="stop --> stop tomcat application"/> <echo message="list --> list tomcat applications"/> <echo message=""/> </target> <target name="build" description="compile main source tree java files"> <mkdir dir="${build.dir}"/> <javac destdir="${build.dir}" source="1.5" target="1.5" debug="true" deprecation="false" optimize="false" failonerror="true"> <src path="${src.dir}"/> <classpath refid="master-classpath"/> </javac> </target> <target name="deploy" depends="build" description="deploy application"> <copy todir="${deploy.path}/${name}" preservelastmodified="true"> <fileset dir="${web.dir}"> <include name="**/*.*"/> </fileset> </copy> </target> <target name="deploywar" depends="build" description="deploy application war file"> <war destfile="${name}.war" webxml="${web.dir}/web-inf/web.xml"> <fileset dir="${web.dir}"> <include name="**/*.*"/> </fileset> </war> <copy todir="${deploy.path}" preservelastmodified="true"> <fileset dir="."> <include name="*.war"/> </fileset> </copy> </target> <!-- ============================================================== --> <!-- tomcat tasks - remove these if don't have tomcat installed --> <!-- ============================================================== --> <path id="catalina-ant-classpath"> <!-- need catalina jars tomcat --> <!-- * other app servers - check docs --> <fileset dir="${appserver.lib}"> <include name="catalina-ant.jar"/> </fileset> </path> <taskdef name="install" classname="org.apache.catalina.ant.installtask"> <classpath refid="catalina-ant-classpath"/> </taskdef> <taskdef name="reload" classname="org.apache.catalina.ant.reloadtask"> <classpath refid="catalina-ant-classpath"/> </taskdef> <taskdef name="list" classname="org.apache.catalina.ant.listtask"> <classpath refid="catalina-ant-classpath"/> </taskdef> <taskdef name="start" classname="org.apache.catalina.ant.starttask"> <classpath refid="catalina-ant-classpath"/> </taskdef> <taskdef name="stop" classname="org.apache.catalina.ant.stoptask"> <classpath refid="catalina-ant-classpath"/> </taskdef> <target name="install" description="install application in tomcat"> <install url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${name}" war="${name}"/> </target> <target name="reload" description="reload application in tomcat"> <reload url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${name}"/> </target> <target name="start" description="start tomcat application"> <start url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${name}"/> </target> <target name="stop" description="stop tomcat application"> <stop url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${name}"/> </target> <target name="list" description="list tomcat applications"> <list url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}"/> </target> <!-- end tomcat tasks --> </project>
i have tomcat installed at: c:\apache-tomcat-7.0.22, current file appears pulling in build.properties file:
# ant properties building springapp appserver.home=${user.home}/apache-tomcat-7.0.22 # tomcat 5 use $appserver.home}/server/lib # tomcat 6 use $appserver.home}/lib appserver.lib=${appserver.home}/lib deploy.path=${appserver.home}/webapps tomcat.manager.url=http://localhost:8080/manager tomcat.manager.username=tomcat tomcat.manager.password=s3cret
and it's defaulting c:/documents , settings/etc...
i've never used properties files ant. how set point real tomcat directory?
just change set appserver.home c:\apache-tomcat-7.0.22 in build.properties file
appserver.home=c:\apache-tomcat-7.0.22
Comments
Post a Comment