A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
forum!
JavaRanch
»
Java Forums
»
Engineering
»
Ant, Maven and Other Build Tools
Author
Install task cannot find file
Vinod Maladkar
Greenhorn
Joined: Jan 05, 2012
Posts: 1
posted
Jan 05, 2012 12:56:51
0
I changed the build.xml with Deploytask..
getting..
java.io.FileNotFoundException
: SpringApp (The system cannot find the file specified)
I am using Windows7 laptop and runing Spring samples..........................
<target name="install" description="Install application in Tomcat">
<echo message="-------------${name}----------------" />
<install url="${tomcat.manager.url}"
username="${tomcat.manager.username}"
password="${tomcat.manager.password}"
path="/${name}"
war="${name}"/>
</target>
Does anyone why this is happening? It is creating folders in
Tomcat
webapps folders without any issues....From below example: name = SpringApp....I tried with other values too....but fails in Install task...
below is entire build.xml
<?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> <!-- We need the servlet API classes: --> <!-- * for Tomcat 5/6 use servlet-api.jar --> <!-- * for other app servers - check the 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 the application"/> <echo message="deploy --> Deploy application as directory"/> <echo message="deploywar --> Deploy application as a 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 as a 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 you don't have Tomcat installed --> <!-- ============================================================== --> <path id="catalina-ant-classpath"> <!-- We need the Catalina jars for Tomcat --> <!-- * for other app servers - check the docs --> <fileset dir="${appserver.lib}"> <include name="catalina-ant.jar"/> </fileset> </path> <taskdef name="install" classname="org.apache.catalina.ant.DeployTask"> <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"> <echo message="-------------${name}----------------" /> <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"> <echo message="-------------reload----------------"/> <reload url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${name}"/> </target> <target name="start" description="Start Tomcat application"> <echo message="-------------start----------------"/> <start url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${name}"/> </target> <target name="stop" description="Stop Tomcat application"> <echo message="-------------stop----------------"/> <stop url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${name}"/> </target> <target name="list" description="List Tomcat applications"> <echo message="-------------list----------------"/> <list url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}"/> </target> <!-- End Tomcat tasks --> </project>
Peter Johnson
author
Bartender
Joined: May 14, 2008
Posts: 5541
I like...
posted
Jan 06, 2012 09:46:27
0
Vinod, welcome to Java Ranch!
The error message says it all, you should have been able to fix the problem based on that alone. But here are some hints:
Look at line 60 where you declare the name of your war file.
Then compare that to line 107 where you tell the <install> task the name of the war file.
What's missing on line 107?
JBoss In Action
I agree. Here's the link:
http://zeroturnaround.com/jrebel
- it saves me about five hours per week
subject: Install task cannot find file
Similar Threads
Ant script not finding my build.properties file
Ant list -- Build Failed
Error The requested resource is not available
Need help in build applications using ant : getting exception
Spring coniguration
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter