Thursday, 19 September 2013

file not found exception while deploying versioned application in Tomcat with ant

file not found exception while deploying versioned application in Tomcat
with ant

I try to build a Target "deploy" in my build.xml Ant build file. the
deploy line is the well known :
<deploy url="${url}" username="${username}" password="${password}"
path="${warfile}" war="file:${filePath}"/>
Everithngs works fine if the {filePath} Property contais for example
E:\workspace\testweb\testweb.war
now the problem: Tomcat allows to set a version in the name by adding
##versionNumber to the name of the war.
this "versioned filename" looks like to:
E:\workspace\testweb\testweb##1.9.1.war
So I try to use a "versioned" name for the war file as follows:
<target name="deploywar">
<property name = "url" value = "http://testweb:8080/" />
<property name = "username" value = "tomcats"/>
<property name = "password" value = "tomcats"/>
<property name = "warfile" value ="testweb"/>
<property name = "version" value ="1.9.1"/>
<property name = "filePath" value
="E:\workspace\testweb\${warfile}##${version}.war"/>
<echo>filePath= ${filePath}</echo>
<echo>warfile = ${warfile}</echo>
<deploy url="${url}" username="${username}" password="${password}"
path="${warfile}" war="file:${filePath}"/>
</target>
In this case, the ant build, fails the deploy task giving the following
result:
Buildfile: E:\workspace\testweb\build.xml
deploywar:
[echo] filePath= E:\workspace\testweb\testweb##1.9.1.war
[echo] warfile = testweb
BUILD FAILED
E:\workspace\testweb\build.xml:341: java.io.FileNotFoundException:
E:\workspace\testweb\testweb (The system cannot find the file specified)
Total time: 328 milliseconds
It seems that Deploy task cannot read the name after the ## !!
If I remove only the "##1.9.1" part the deploy end with success. It's a
bug or an error by me? Is there a workaround? Thank you.

No comments:

Post a Comment