简体   繁体   English

从Eclipse运行tomcat

[英]Running tomcat from eclipse

I have tomcat setup from eclipse, so I don't have to copy the war over every time to the server. 我有从eclipse安装的tomcat,因此不必每次都将战争复制到服务器。 I followed some online tutorial (don't recollect which one) to set it up. 我遵循了一些在线教程(不要回想哪个教程)进行设置。 I see the below issue when I click on publish - 当我点击发布时,我看到以下问题-

在此处输入图片说明

I clicked on add and remove of my project, and published again. 我单击添加和删除我的项目,然后再次发布。 No change. 没变。 Its still grayed out. 它仍然变灰。 I have set it up in such a way, that all the logs I'd typically see on the server can now be viewed on my local machine. 我以这种方式进行设置,现在可以在本地计算机上查看通常在服务器上看到的所有日志。 I can't recollect how I did the setup, but as of now, I see the logs aren't getting populated either. 我无法回忆起如何进行设置,但是到目前为止,我也没有看到日志。 Can anyone please help me with both these issues? 任何人都可以在这两个问题上帮助我吗?

You can deploy a Tomcat application "in-place", by putting a custom <Context> element in your server.xml. 您可以通过在server.xml中放置自定义<Context>元素来“就地”部署Tomcat应用程序。 This context can refer to a /www folder within your project, with your project output-path set to compile into /www/WEB-INF/classes . 此上下文可以引用项目中的/www文件夹,并且将项目的output-path设置为可编译为/www/WEB-INF/classes

For example: 例如:

<!-- JobRoute;  run from within Eclipse project.
 -->
<Context docBase="C:/WS/jobRoute/www" path="/jr" reloadable="true">
</Context>

Tomcat will then automatically run & reload from the /www folder within your project, can reload automatically when you recompile (if you want), and no deployment whatsoever is necessary. 然后,Tomcat将自动从项目中的/ www文件夹运行并重新加载,可以在重新编译时自动重新加载(如果需要),并且不需要进行任何部署。

Typically we use this technique & add a shortcut to start Tomcat (in debug mode) under "External Tools" in Eclipse. 通常,我们使用此技术并在Eclipse的“外部工具”下添加快捷方式以启动Tomcat(以调试模式)。

As for your "Eclipse - Tomcat" builtin integration, I've never found them to work well (always difficult to configure, and generally either didn't work or awkward & slow) and gave up on those long ago. 至于您的“ Eclipse-Tomcat”内置集成,我从来没有发现它们能很好地工作(总是很难配置,并且通常要么不起作用,要么笨拙而缓慢),并且早就放弃了。 So no tips from me there. 所以那里没有我的提示。

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

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