IntelliJ IDEA 远程部署tomcat应用

来源:互联网 发布:360数据恢复大师损坏 编辑:程序博客网 时间:2024/05/18 20:50

这篇文章主要记录在Intellij idea开发web程序时,将应用部署到远程服务器上,实现远程部署。而不需先在本地调试好之后,通过putty、WinScp等文件传输软件手动传输。

环境
远程端服务器:linux(ubuntu)、tomcat
本地开发环境:intellij idea 、SecureCRT(远程登陆ssh工具)

先假设远程服务器端tomcat已经配置完成,可以访问(再假设已经实现过了”hello wrold”测试)。

第一步:
在远程服务器端/etc/profile 文件添加

export JAVA_OPTS="-Dcom.sun.management.jmxremote=  -Dcom.sun.management.jmxremote.port=1099  -Dcom.sun.management.jmxremote.ssl=false  -Dcom.sun.management.jmxremote.authenticate=false  -Djava.rmi.server.hostname=10.1.1.98"  #10.1.1.98修改为你的服务器ip地址

修改完成,记得执行 source /etc/profile 。该条命令作用刷新环境变量配置,即使得刚设置JAVA_OPTS生效。在这里配置原因在于,我们通过intellij idea在远程服务器部署,那么就需要和远程服务器端通信、上传代码、文件,这里设置的1099端口就是哨会儿配置要用的。


第二步:


编辑如图Edit Configurations (也可在Run –> Edit Configurations 菜单栏看到)

这里写图片描述

添加–>Tomcat Server –>Remote .

这里写图片描述

图上描述,Name随意取,主要配置好Remote Staging下的Type、Host(怎么配置看下图描述)、Path from root、Mapped as。

这里写图片描述

这里写图片描述

host 配置的描述

这里写图片描述

参考文献:

1. 远程部署:

http://blog.csdn.net/gsm123/article/details/47757665

2.1099端口配置(解决错误Unable to connect port )

http://blog.csdn.net/u010414666/article/details/52060050