简体   繁体   English

在OSX上使用Ant将Webapp远程部署到Tomcat

[英]Deploying a webapp remotely to Tomcat using Ant on OSX

I wish to use the Tomcat install/deploy tasks from catalina-ant.jar to deploy a webapp to a remote app server. 我希望使用catalina-ant.jar中的Tomcat安装/部署任务将Web应用程序部署到远程应用程序服务器。

After installing Ant using the instructions found here , my ant folder is configured as: 按照此处的说明安装Ant后,我的ant文件夹配置为:

/usr/local/ant

My "Ant Home" has also been set to that directory through Eclipse. 我的“蚂蚁之家”也已通过Eclipse设置到该目录。 I copied catalina-ant.jar to my ant/lib folder. 我将catalina-ant.jar复制到了ant / lib文件夹。

My build.xml contains the following: 我的build.xml包含以下内容:

...
<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? 我的/ usr / local / ant目录可能存在权限问题吗? Is there a better place to put catalina-ant.jar? 有没有更好的放置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. 编辑:奇怪的是,如果我将jar放在其他地方(例如,在用户文件夹内的目录中)并在build.xml中更改它的路径,则它可以工作。 Ideas? 有想法吗?

Eclipse cannot see the catalina-ant.jar. Eclipse无法看到catalina-ant.jar。 If it is in your ANT_HOME/lib directory, check what ANT_HOME is eclipse using. 如果它在您的ANT_HOME / lib目录中,请检查正在使用的ANT_HOME。

Go to your Eclipse Preferences > Ant > Runtime and see the classpath tab to see if eclipse can see the jar. 转到Eclipse Preferences> Ant> Runtime并查看classpath选项卡以查看eclipse是否可以看到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. 有时,如果您的ANT_HOME指向正确的位置,则可能需要在添加一个供Eclipse看到的jar之后重新启动Eclipse。

Also, I would test that you can run your build from the command line too, that might help you narrow down the issue. 另外,我将测试您是否也可以从命令行运行构建,这可能有助于缩小问题范围。

Running ant with the -debug flag also helps. 使用-debug标志运行ant也有帮助。 It'll list out all the found jars & classpath info you'll ever need. 它将列出您将需要的所有找到的jar和类路径信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM