first, the problem arisesThe thing is this, originally our web project each is independent, at most is to rely on some packaged as a jar of public project module, but the resource file under WebApp is still independent. However, since our own framework contains a part of the common front-end resource files (JS, CSS, IMG, etc.) and page templates, when the Web project more, file redundancy is more natural, if the framework needs to adjust the changes, it must be changed every project, it is not bored to death? So, we decided to find a way to extract this part of the file, like a jar package needs to be through MAVEN dependencies. However, these files under WebApp should be the structure of a Web project, which should be compiled into a war package, which means that the war package needs to be dependent on the war package. Then listen to the boss said Maven3 above is to support war-dependent war (Maven is really not a cover,Gradle Don't bully others .), decided to refactor the project (refactoring the word is scary) ... The problem came out that we used toTomcat7-maven-pluginplug-in operation (Tomcat7:run) project, actually did not have to rely on the war to pack in! The project is run up but the page is bare-ben ... (Because the core JS, CSS, etc. can not be found) but the use of MAVEN's install command to package the war is to contain the content of the war depends on. That's weird, it must be.Tomcat7-maven-pluginMake the Ghost, and then find a lot of relevant configuration information, thought should be overlay configuration problem, looked for a long time to try N times or not (anyway is not solved, do not find excuses do not say more), but other brothers also need to develop debugging, I this branch also need to merge into the main branch, So we can only go the other ways.
Second, the problem analysis
Since the install package is normal, then I use the external tomcat to deploy should be no problem, immediately under a tomcat, first put the generated war into a run for a while, thump thump thump sure no problem. OK, then use Eclipse to bind the external Tomcat, debug debug, with the virtual path, and then the Jrebel 6 to go up (before Jrebel 5 with a bug sometimes will expire, heard that Jrebel 6 fixed) to achieve hot deployment, As long as the changes are completed and reinstall, do not need to restart Tomcat, but also a good solution ~ Only the previous modification of the Web resource files can be updated immediately, now need to install a bit (not "hot Code" codes will be reloaded without install), But there is no way to do it. Don't ask why you don't have to bring your own Tomcat server, we're using the Eclipse Javase version (that was the wrong hahaha, crying), and we tried Tomcat server andTomcat7-maven-plugindid not pack the dependent war in, so I found it on the Internet.Tomcatplugin This plugin, under the latest version of V331, and then the next Jrebel 6.3.0, you can start to dry. tomcatplugin Download:Http://www.eclipsetotale.com/tomcatPlugin.htmlJRebel 6.3.0 (cracked you know)
third, the solution steps1, install the Tomcatplugin plug-in (offline installation, put into Eclipse's plugins directory), restart the server and then appear in the button:
2.Enter the Window->preferences->tomcat, bind the set of Tomcat, and don't forget to match the virtual path in Server.xml or Catalina/localhost to the Web project in target.
3, into the JVM settings download a good jrebel matching, click "Create a Launch Configuration" (you can not point to try, I came up on the point, and did not try to do not do not have a bit of work = = In the colleague's machine does not seem to be not good), Match the path to your file. Because the Jrebel is a JVM plug-in, so it is in the JVM parameters of the-javaagent parameter, the parameters below the red box is only equipped with the above parameters to run, the JVM hint must be added, the specific role I do not delve into.
4, the project source file binding on, can debug debugging.
5, the project all install good, click "Start Tomcat" successful start without error, the startup process appears below the log, then the binding on the Jrebel:
6, modify the Log4j.xml again install, appear below reloading configuration is Jrebel heat deployment has been in effect, hurriedly hit a breakpoint debugging up ~
Iv. SummaryIn fact, the heat deployment is not so hot, when the change to some of the ' Hot code ', Jrebel will not reload the code, but at least modify some of the configuration files are not restarted, or even modify some of the dependencies of the Jar project code does not have to restart OH. There are many solutions, this is not the best solution, but it is important to solve the problem, but also to solve the problem of the idea, and finally to choose the simplest and best suited to the team's solution. This time I realized how great integration development is, and if all the work is not developed using tools such as Eclipse, Maven, Jrebel, and so on, from coding and compiling to debugging and deployment, at least 10 times times more work! So, good programmers should use computer automation to do repetitive work, less is more! Finally, if the post has the wrong place, please correct, if there are better ideas and solutions, kneeling to share; If you have a good idea, welcome to communicate!
Use Tomcatplugin with Jrebel to troubleshoot MAVEN project-dependent war packaging and hot deployment issues