Java 从 Eclipse 远程部署 Tomcat webapp

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1760297/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 22:23:18  来源:igfitidea点击:

Remote deploy Tomcat webapp from Eclipse

javaeclipsetomcat

提问by leeeroy

For development and testing purposes I'd like to deploy my webapp from within eclipse to a remote tomcat server. Is this possible ? If not, how should I set up my development environment for smooth and easy remote deployment ?

出于开发和测试目的,我想将我的 webapp 从 eclipse 中部署到远程 tomcat 服务器。这可能吗 ?如果没有,我应该如何设置我的开发环境以便顺利和轻松地进行远程部署?

采纳答案by Chris Harcourt

If you can access the Tomcat manager application remotely then you can use the Tomcat Ant tasksor Tomcat Maven pluginto handle this. Both of these can then be called from within Eclipse.

如果您可以远程访问 Tomcat 管理器应用程序,那么您可以使用Tomcat Ant 任务Tomcat Maven 插件来处理此问题。然后可以从 Eclipse 中调用这两者。

Using either Ant or Maven also gives you the advantage of being able to deploy from outside of Eclipse. In my experience separating deployment from the IDE is helpful (our sysadmins don't run Eclipse!).

使用 Ant 或 Maven 还为您提供了能够从 Eclipse 外部进行部署的优势。根据我的经验,将部署与 IDE 分开是有帮助的(我们的系统管理员不运行 Eclipse!)。

My personal choice is Maven, but Ant is equally capable in this area. I also use Maven profiles to let me easily switch between local/remote deployment (different server, passwords, etc).

我个人的选择是 Maven,但 Ant 在这方面同样有能力。我还使用 Maven 配置文件让我轻松地在本地/远程部署(不同的服务器、密码等)之间切换。

回答by BalusC

You can use the AntFTP taskor SCP taskfor this. You can find examples here.

为此,您可以使用Ant FTP 任务SCP 任务。您可以在此处找到示例。

回答by Pascal Thivent

For development and testing purposes I'd like to deploy my webapp from within eclipse to a remote tomcat server. Is this possible ?

出于开发和测试目的,我想将我的 webapp 从 eclipse 中部署到远程 tomcat 服务器。这可能吗 ?

The Tomcat support in WTP only works with a local Tomcat. That said, there is a tomcat deployerplugin that can be used to deploy to a remote tomcat (never tested personally).

WTP 中的 Tomcat 支持仅适用于本地 Tomcat。也就是说,有一个tomcat 部署器插件可用于部署到远程 tomcat(从未亲自测试过)。

If not, how should I set up my development environment for smooth and easy remote deployment ?

如果没有,我应该如何设置我的开发环境以便顺利和轻松地进行远程部署?

If you don't like the plugin, then you could use build tools like Ant or Maven, they have good support for remote deployment trough the manager application as pointed out by Chris. I'd just add Cargoto the list (Tomcat remote deployment is only available with the Maven 2 plugin though).

如果您不喜欢该插件,那么您可以使用 Ant 或 Maven 等构建工具,正如 Chris 所指出的,它们通过管理器应用程序对远程部署提供了良好的支持。我只是将Cargo添加到列表中(尽管 Tomcat 远程部署仅适用于 Maven 2 插件)。

Actually, using a build tool would be a good idea regardless of Eclipse capabilities in my opinion.

实际上,在我看来,无论 Eclipse 功能如何,使用构建工具都是一个好主意。