简体   繁体   English

使用Maven&Eclipse和Glassfish 4进行热部署/增量Java部署?

[英]Hot deployment / incremental Java deployment using Maven & Eclipse & Glassfish 4?

I am developing a Web GWT application, using Eclipse, Glassfish 4 for the local server part. 我正在开发一个Web GWT应用程序,使用Eclipse,Glassfish 4作为本地服务器部分。 I just started using Maven for the build. 我刚开始使用Maven进行构建。

My projects are structured like this: 我的项目结构如下:

* My core java classes (“ProjectCore”)
   Pom.xml => generates a JAR

* My custom java classes (“ProjectCustom”)
   Pom.xml => generates a JAR

* My web-app related java classes (“ProjectWeb”)
    Pom.xml => generates a JAR

* My WAR project (“WARproject”)
    Pom.xml => generates a WAR

* My EAR project (“EARproject”)
    Includes all of the above
    Pom.xml => generates an EAR

I managed to configure all the pom.xml files to generates all required JARs, WAR and EAR, and it successfully deploys to Glassfish (done by calling maven from command line) 我设法配置所有pom.xml文件以生成所有必需的JAR,WAR和EAR,并成功部署到Glassfish(通过从命令行调用maven完成)

However, in a development mode, where I frequently modify files & retest the app, the deployment takes too much time (1-2 minutes). 但是,在开发模式中,我经常修改文件并重新测试应用程序,部署需要花费太多时间(1-2分钟)。 Compiling and generating the JARs/WARs/EARs is still pretty fast but the actual undeployment + deployment on Glassfish takes more than 1 minute. 编译和生成JAR / WAR / EAR仍然相当快,但Glassfish上的实际取消部署+部署需要超过1分钟。

I am wondering how I can do hot deployment to GlassFish4 (also called 'directory' deployment), skipping all JAR/WAR archive generation, and only copying to GlassFish whatever files have been modified. 我想知道如何对GlassFish4进行热部署(也称为'目录'部署),跳过所有JAR / WAR存档生成,并且只复制到GlassFish,无论文件是否被修改过。 I'd like the complete cycle "modify source file - deploy to Glassfish" to take a few seconds only... 我想完整的循环“修改源文件 - 部署到Glassfish”只需几秒钟......

I have been searching quite a lot but without success so far… 我一直在搜索很多但到目前为止没有成功......

Could someone give me some directions to follow? 有人可以给我一些指示吗? - using "maven glassfish" plugin? - 使用“maven glassfish”插件? - should I go for M2E-WTP plugin? - 我应该选择M2E-WTP插件吗? - anyone using "manik-hot-deploy" Maven plugin? - 任何使用“manik-hot-deploy”Maven插件的人?

Thanks in advance! 提前致谢!

Thanks for the feedback - I couldn't find the "maven glassfish plugin" from the Eclipse Marketplace. 感谢您的反馈 - 我找不到Eclipse Marketplace中的“maven glassfish插件”。 However : - I have installed M2E-WTP - Ensure that the "deploy on build" is checked (on my Glassfish server) 但是: - 我已经安装了M2E-WTP - 确保选中“build on build”(在我的Glassfish服务器上)

Everything works very well now. 现在一切都很好。 Whenever I make change, all code is compiled and automatically deployed within 1 or 2 seconds :-) 每当我进行更改时,所有代码都会在1或2秒内编译并自动部署:-)

I think I was getting confused between the M2E-WTP (which does the work perfectly & seamlessly) and the "Maven build Run As" (this is what I was running and in my Pom.xml I was calling the maven-glassfish plugin to deploy to the server: very slow as it was doing a full undeploy & deploy). 我认为我在M2E-WTP(完美无缝地完成工作)和“Maven build Run As”之间感到困惑(这就是我正在运行的,在我的Pom.xml中我称之为maven-glassfish插件部署到服务器:非常慢,因为它正在进行完全取消部署和部署)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM