且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将 Java Web 应用程序项目从 Eclipse 部署到实时 Tomcat 服务器?

更新时间:2023-09-21 08:18:17

  1. 您必须构建项目的 WAR.你可以这样做

  1. You will have to build a WAR of the project. You can do this

  • 在eclipse中:右键单击项目,单击导出",然后在对话框中选择war文件(并提及,目的地,名称等)
  • 通过 ant 使用 war 任务

ant 选项更好,因为当项目有多个开发人员并且代码处于版本控制中时,更容易自动获取项目(使用 ant)并构建战争.(你有版本控制,不是吗?)

The ant option is better because when you have multiple developers on the project and the code is in version control, it is easier to get the project automatically (using ant) and build a war. (you have version control, don't you?)

但这更多是一个操作差异(尽管很重要),但以任何一种方式引发的战争都是一样的

But this is more of an operational difference (albeit an important one) but the war created in either way are same

将战争部署到服务器

  • 您可以手动将 WAR 文件复制到 $TOMCAT_HOME/webapps 目录(请参阅 这篇文章)

您可以使用 Tomcat 6 管理器"应用程序.

You can use the Tomcat 6 "Manager" application.

更新
你说你也在使用MySql.MySql 应该安装在服务器上(它可以在同一台服务器上)并且应该更改配置(用户名、密码、服务器详细信息),以便应用程序连接到同一个数据库(我确定您不是在应用程序中硬编码数据库详细信息和凭据并从某些配置中读取它们,这是必须更改的配置)

Update
You said that you are using MySql also. MySql should be installed on a server (it can be on the same server) and the configuration should be changed (username, password, server details) so that the application connects to the same database (I am sure you are not hard coding database details and credentials in your application and reading them from some configuration, this is the configuration that has to be changed)