eclipse编写代码不用重新maven编译,在resin服务器下

一般用maven构建的项目,在eclipse中编码完之后,都要先停止服务器,重新maven编译一次,然后再重启服务器,比较麻烦。

假设服务器用resin,在resin的项目配置文件xx.conf里,定位项目路径如下配置:

<web-app id="/bbs7" document-directory="D:\eclipseWorkspace\bbs7\branches\bbs7.0_pie_20130905\target\webapp" lazy-init="false">
     	</web-app>

 这个路径指向maven构建完成之后的target项目路径,此时就像刚刚说的那样,编码一次,要重新构建,比较麻烦。但是,如果路径不指向构建好的target项目,而指向maven的自身组织的src下面main下面的webapp的话,再相应地配置好编译路径和lib路径(也要配置在target文件夹下面),就不用停止服务器再构建项目,而是直接在运行中的服务器上面,看到编码之后的效果,如:

<web-app id="/" root-directory="D:\eclipseWorkspace\morden\trunk\morden\src\main\webapp"> <!-- configurate web directory -->
			<prologue>
				<class-loader>
					<compiling-loader path="D:\eclipseWorkspace\morden\trunk\morden\target\classes"/> <!-- configurate class directory -->
					<library-loader path="D:\eclipseWorkspace\morden\trunk\morden\target\morden-1.0\WEB-INF\lib"/> <!-- configurate library directory -->
				</class-loader>
			</prologue>
		</web-app>

以上配置是因为eclipse的自动编译功能,修改文件之后,不用重新maven编译构建,就已经编译好项目了,就像普通项目运行在tomcat的debug模式下,比较方便文件修改。但如果项目重新加了 jar包,这个方法就不录了,还得老老实实地停止服务器,重新maven构建,再启动服务器了。

猜你喜欢

转载自breezylee.iteye.com/blog/1997630
今日推荐