When using the MAVEN multi-module architecture, while there are multiple Web projects that use Maven-war-plugin's overlay to organize, how to start a container in eclipse in the local development, and can be hot deployment debugging is a more troublesome problem, have been using Maven-tomcat-plugin before,
There is no denying that Tomcat is the quickest and most convenient, but there is a problem that has not been solved, that is, overlay support is not good, For example Weba has a A.JSP,WEBB has a b.jsp, if Webb rely on Weba, use overlay packaging no problem, you can put a.jsp and b.jsp all into the war package, but when using Tomcat run Webb, a.jsp access. It's very inconvenient. The advantage of Tomcat is that modifying the JSP directly takes effect, and modifying the class file will automatically re-heat the deployment faster.
Using jetty can solve the problem of overlay, but the disadvantage of jetty is to start slowly, because each hot deployment will be redeployed under TARGET/TMP, if you jar more, copy will be a certain amount of time.
But jetty can support overlay very well, here are some scenarios for using jetty configuration
Normal operation mode:
1. Configure Manual Reload
<scanTargets>
<scantarget>, .... /childmodule/target/classes</scantarget>
</scanTargets>
<scanIntervalSeconds>0</scanIntervalSeconds>
<reload>manual</reload>
This allows you to manually enter reload after each modification, and then jetty to redeploy
If you modify the Childmodule inside the class, you will find that it does not work, need to install a bit, and then reload to work.
2. Configure Automatic Reload
<scanTargets>
<scantarget>, .... /childmodule/target/classes</scantarget>
</scanTargets>
<scanIntervalSeconds>5</scanIntervalSeconds>
So every time you modify the Childmodule inside the class, will automatically reload, but you will find that the changes or does not work, still need to install a bit childmodule.
3. Configure manual reload, do not configure Scantargets
<scanIntervalSeconds>0</scanIntervalSeconds>
<reload>manual</reload>
So every time after modifying the childmodule, manually install a bit, and then reload, but also the same effect
3. No matter how it is configured, if you modify the class or JSP under Web Engineering, it will work immediately.
Debug mode:
1. Configure Manual Reload
Modify the class file immediately after the effective, do not need to reload, if the reload is not effective, if it is overlay Web project inside the JSP, do not, must re-install+reload
2. Configure Automatic Reload
Modify the class file will be reload, the modification will not take effect, need to install and then reload to take effect, probably because after the reload is the same as reloading the jar package, and the jar package is still old
Summary: Use debug mode when developing, or Normal mode + manual reload Best, scantargets feel useless
Use jetty Hot deployment in MAVEN multi-module architecture and with overlay