前几天曾经抱怨新公司的开发环境太复杂,不能Hot Deploy,极其影响开发的效率,今天成功的在Eclipse(实际上是MyEclipse)中配置好了可以Hot Deploy的环境,其实也很简单,我们的工程发布非常的复杂,sar, ear, har, jar, war一个套一个,要想严格的按照那个目录结果配置工程几乎不可能,但是要想Hot Deploy很简单,配置一个Web工程,引入全部的工程需要的类,把Jar包修改为手工发布,然后使用MyEclipse的Manage Deployment发布,只要你的这个web工程先于原来的工程发布就行了,对于同名的类,由于新的工程先加载,所以也就可以达到Hot Deploy的目的了,现在修改了源代码,保存一下就可以生效了,爽啊
更新:
关于类加载,找到理论依据:
Packaging J2EE applications for JBOSS 3.2.1
By default, all the EARs in a jboss instance, under, JBOSS_HOME/server/jboss-instance-name/deploy/ use the same loader repository and hence, a class found in one can be used by the other. But we don’t like calling this bug a feature as it goes against the idea of scoping by EAR. Fortunately, JBoss provides a way to supress this behaviour through what they call as deployment based scoping.
发表评论