Setup to quickly reload changes in a java web application in development using eclipse, maven, spring, hibernate, jsf
I'm developing a J2EE web application using Eclipse IDE, Maven and Tomcat as a web server. I managed to configure it to launch and debug from eclipse and resolve dependencies from workspace and from Maven.
Building with Maven takes up to 120 sec (building each module, then deploying web-app using war:inplace), and reloading takes also up to 120开发者_如何学JAVA secs (hibernate, spring, jsf, etc) It's a pain in the neck to reload full server each time I need to make a change in the project.
My project structure is a Maven "composite" project (in modules). When I make a change to an existing method, I don't need to reload, but when I add 1 method, class, attribute, etc. I do need.
I've read that using JRebel is an option, but I can't afford it, so I wonder if there isn't any other way to quickly make changes to bussiness code without having to reload full app.
I've also setup eclipse to NOT automatically reload web-app and not to auto-sync web resources (otherwise my server detected changes and started reloading). This is good to sync resources on demand (clicking publish button), but with Java code seems not to work.
Since you're using Eclipse, use the M2Eclipse plugin from sonatype here:http://m2eclipse.sonatype.org. This will export the classes created by the Eclipse compiler directly to Tomcat. No need to run an "mvn clean compile" or "mvn clean package" command :D
Simply make a change to your code and Eclipse will publish the change instantly. If the change is to a classfile, you'll have to bounce Tomcat, but that takes all of about 4.83324523 seconds with Java 1.6 on a decent intel box.
Keep in mind though, if you're letting Eclipse do the builds, and you invoke a Maven build underneath it, Eclipse will be confused why the contents of the target folder changed. You can mitigate this by deleting the target folder, refreshing (f5) the project, and forcing a clean inside Eclipse.
精彩评论