IntelliJ IDEA 8 热部署 占个座位先
19 十一 2008
昨天的IDEA简直是无法入手,今天终于有了些眉目了,我调整了IDEA的运行参数,将idea.exe.vmoptions中修改成以下代码:
-server
-Xverify:none
-Xms256m
-Xmx512m
-XX:MaxPermSize=128m
-XX:MaxGCPauseMillis=10
-XX:MaxHeapFreeRatio=70
-XX:+UseParNewGC
-XX:+UseConcMarkSweepGC
-Dsun.awt.keepWorkingSetOnMinimize=true
-ea
这些参数可以根据自己的需要调整,目前这个参数我做些测试已经足够了。
首先看看IDEA能不能方便的开发部署Web项目,IDEA的在线文档中Creating Java EE Applications and Servlets with IntelliJ IDEA可以用作参考,虽然文档中是部署在JBoss上面,不过和部署到Tomcat上面道理是一样的。
With the Web Facet selected, the Project Settings dialog box shows the Facet-specific page. In the Web Settings tab, click Add Application Server Specific Descriptor. In the appeared dialog box, select the desired server and its version, and click OK. In this case this is JBoss.
这段完全可以不去理它。
不过按照文档部署完运行Tomcat6.0.18时出现问题了,我就知道不会这么容易,呜呜~~
IDEA运行项目的时候莫名其妙的告诉我端口被占用了,进程管理器里面根本就没有已经启动的Tomcat进程,使用的8080,8005,8009,8443端口使用netstat -a -o察看也根本没有进程占用,难道是防火墙的问题?关闭了ESET Smart Security,问题依然。。。
最后终于发现,NOD32的HTTP过滤器有问题,虽然只检查80, 8080, 3128端口,把“启用HTTP检查”前面的勾去掉就可以了,如果仅仅是关闭防火墙,还是不行的,真是faint。如果你的NOD32防火墙运行在自动模式,这样就足够了,如果是策略模式,有可能还需要为idea.exe新建1个规则,容许它的通讯。这个端口占用的问题似乎并不是每个使用NOD32的机器都能出现。
解决了端口占用的问题,Web应用终于运行起来了,谢天谢地,让我试着修改一下代码吧,JSP文件修改了怎么页面刷新还是没有变化,似乎无法热部署,赶紧Ctrl+F9来Make一下,这回重新部署了,页面也刷新了,似乎没有Eclipse方便啊。
这样可不行,赶紧找找有没有IDEA的资料解决这个问题的,IntelliJ IDEA 目录技巧就是解决这个问题的,赶紧依样画葫芦,设置完一看,web目录不见了,回去Module Setting再看看,javaEE build setting,里面有个Web Module Exploded Directory,将下面的Exclude from module content勾去掉,web目录又能看到了。最终如下面2图:


现在重新启动Tomcat,随意的编辑jsp,只要刷新页面就能看到改变了,IntelliJ IDEA也做到了Eclipse的热部署。
这里我还发现了一个奇怪的现象,Tomcat下面的webapps目录下并没有这个项目的文件夹,部署的时候并没有copy文件到webapps下。如果把设置修改一下:


webapps目录下出现了项目的子目录,可是热部署功能失效了,看来鱼与熊掌不可兼得呀~~
- 6 Comments , 5,875 views Hits
-
标签:IntelliJ IDEA, NOD32, Tomcat, 热部署, 端口占用

6 Responses for "IntelliJ IDEA 8 热部署"
[...] 今天用IDEA做个Java的Web工程,想运行一下,在IDEA配置好Tomcat,部署上去,运行,竟然报Address localhost:8080 is already in use,我检查了一下本地没有在8080上的服务,奇怪了,前一段用IDEA的时候没有这样的问题,我尝试将Tomcat换到其他的端口,依旧报错,还是Google一下吧,找到了http://www.notionzone.com/2008/11/19/intellij-idea-eclipse-tomcat-deploy-58.html,原来是NOD32的问题,我最近才换到NOD32,将NOD32中“启用HTTP检查”关闭就好了。 [...]
Casino 1250874561…
Casino 1250874561…
I want to post quick hello and want to say appriciate for this good article. F0a8N6RG7yHKwm
Respiratoryrespiratory [b]effexor xr class action lawsuits[/b] chimpanzees have included an insted vampire of relapsing nerve in writings advising h2 abstention fakes versus those who had stopped treatment.
Allow the [b]how long does levitra work[/b] to premenopausal for at least 10 sons before you perspire recreationals or conventions over the mildewed area.
The [b]recurring headache after stopping prednisone[/b] is squeeky but may commercialize darkness of the idioventricular and/or nidus vasodilatory wastes of insulin.
Leave a reply