好吧,我也在进行非常类似的设置,所以这里是我的2美分。
首先,使用Maven-
Jetty插件将脚弄湿。使它扫描文件中的更改,以便您不必为每个更改重建/部署整个项目。还要将其配置为存储会话,以便在进行每次(自动)部署时都无需重新登录并进入更改前的状态:
<plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> <version>6.1.24</version> <configuration> <stopPort>9669</stopPort> <stopKey>myapp</stopKey> <!-- Redeploy every x seconds if changes are detected, 0 for no automatic redeployment --> <scanIntervalSeconds>3</scanIntervalSeconds> <connectors> <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector"> <port>8080</port> <maxIdleTime>60000</maxIdleTime> </connector> </connectors> <webAppConfig> <contextPath>/myapp</contextPath> <sessionHandler implementation="org.mortbay.jetty.servlet.SessionHandler"> <sessionManager implementation="org.mortbay.jetty.servlet.HashSessionManager"> <storeDirectory>${project.build.directory}/sessions</storeDirectory> </sessionManager> </sessionHandler> </webAppConfig> </configuration> </plugin>现在,到项目
Properties(右键单击项目)>
Build>
Compile>
Compile on save和选择
For bothapplication and text execution。
也去
Options>
Miscellaneous>
Maven>和检查/选择
Skip Tests for any buildexecutions not directly related to testing,这样的测试只运行当你真正运行“测试”。
按照这些简单的步骤,我可以实时进行编码和测试更改,而无需重新部署。也就是说,我遇到了一些小问题/烦恼:
在某些不起作用的时间(例如,您删除了某些内容且更改未反映出来)时,您仍然必须清理构建
使其长时间运行会导致PermGen异常(空间不足),这是合理的,并且您始终可以使用jvm opts增加内存
一旦习惯了此设置,您将不愿在jboss / websphere等容器上开发/测试项目



