j2ee应用程序不能独立运行,须要运行在一个servlet/jsp容器中,经常使用的servlet/jsp容器如:tomcat,jetty等。
在开发调试j2ee程序时,也须要部署在一个指定的容器中。
若是每次为了debug一行修改的java代码都要重复执行一次部署的操做,将会大大下降开发效率。
为了解决这个问题,目前有2个工具能够使用。html
1. run-jetty-runjava
官网:https://github.com/xzer/run-jetty-run
这是一个eclipse插件,只能在eclipse下使用。
安装使用教程见官网手册:https://github.com/xzer/run-jetty-run/wiki/GettingStarted。
该插件使用jetty容器进行项目热部署调试,无需复杂的设置,很是方便。git
2. Apache Tomcat Maven Plugingithub
官网:http://tomcat.apache.org/maven-plugin-2.2/index.html
这是一个maven插件,项目必须是经过maven进行管理。详见:http://tomcat.apache.org/maven-plugin-2.2/run-mojo-features.html。
配置示例以下:apache
<build> <plugins> <!-- tomcat插件:开发调试--> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <configuration> <!-- http port --> <port>8080</port> <!-- application path always starts with / --> <path>/</path> </configuration> </plugin> </plugins> </build>
启动插件:mvn tomcat7:runtomcat
3. Jetty Maven Pluginapp
官网:https://www.eclipse.org/jetty/documentation/9.4.x/jetty-maven-plugin.html#jetty-start-goal
这是一个Maven插件,项目必须使用maven进行管理。
不须要独立安装,不与任何编辑器绑定,直接配置为一个build插件便可。eclipse
<build> <plugins> <plugin> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>9.2.8.v20150217</version> <configuration> <scanIntervalSeconds>5</scanIntervalSeconds> </configuration> </plugin> </plugins> </build>
启动插件:mvn jetty:runjsp
总结:maven