1
votes

I wish to use the Tomcat install/deploy tasks from catalina-ant.jar to deploy a webapp to a remote app server.

After installing Ant using the instructions found here, my ant folder is configured as:

/usr/local/ant

My "Ant Home" has also been set to that directory through Eclipse. I copied catalina-ant.jar to my ant/lib folder.

My build.xml contains the following:

...
<path id="catalina-ant-classpath">
  <fileset dir="${ant.home}/lib">
    <include name="catalina-ant.jar"/>
  </fileset>
</path>
<taskdef name="install" classname="org.apache.catalina.ant.InstallTask">
  <classpath refid="catalina-ant-classpath"/>
</taskdef>
...

Yet my build fails with the following error:

build.xml:83: taskdef class org.apache.catalina.ant.InstallTask cannot be found

Could there be a permissions issue going on with my /usr/local/ant directory? Is there a better place to put catalina-ant.jar?

EDIT: Strangely enough, if I put the jar somewhere else (say, in a directory inside of my user folder) and change the path to it in my build.xml it works. Ideas?

2

2 Answers

3
votes

Eclipse cannot see the catalina-ant.jar. If it is in your ANT_HOME/lib directory, check what ANT_HOME is eclipse using.

Go to your Eclipse Preferences > Ant > Runtime and see the classpath tab to see if eclipse can see the jar. Sometimes if your ANT_HOME is pointing to the right place, you may still need to restart Eclipse after adding a jar for Eclipse to see it.

Also, I would test that you can run your build from the command line too, that might help you narrow down the issue.

3
votes

Running ant with the -debug flag also helps. It'll list out all the found jars & classpath info you'll ever need.