Java maven development slow

2019-04-14 06:44发布

问题:

I am developing a war/java website that is built via maven.

Currently, I have to make changes... tell maven to build them... then deploy to Tomcat. This is around 40seconds. So every change I make, I have to wait >=40seconds to see the change.

This is becoming very frustrating, so I have tried to speed up the deployment. I deployed the site via maven with war:exploded. Now, I edit the files live in 'deployed' format. The problem being I will need to move these changes back to the source location for pushing into our source control.

So has anyone written a script to 'undeploy' changes on the server carefully pointing them back to where maven expects them to be, or found another way I can instantly see my changes in a web browser. Rebuilding from source everytime is not a fun solution.

回答1:

Currently, I have to make changes... tell maven to build them... then deploy to Tomcat. This is around 40seconds. So every change I make, I have to wait >=40seconds to see the change.

This is just a wrong way to use Maven in my opinion.

Either use something light like jetty:run (and hook Eclipse remote debugger to enable hotswap), see Configuring Jetty, Maven, and Eclipse together with Hot Swap.

Or use Eclipse WTP and deploy your project on a Tomcat server inside Eclipse (your project can be recognized as a Dynamic Web project whether you're using m2eclipse or the Maven Eclipse plugin).



回答2:

Have you tried JavaRebel?

http://www.zeroturnaround.com/jrebel/



回答3:

Use hot-deployment. Just configure tomcat-maven-plugin and try tomcat:redeploy.