Update the project’s main module’s pom.xml file with: Use startup.bat and shutdown.bat to control your tomcat instance. Update the javaagent param with the path to your installed jrebel.jar and the Xrunjdwp port with your IntelliJ debug port. Set CATALINA_OPTS=-Drebel.remoting_plugin=true -javaagent:C:\jrebel\jrebel.jar -Xdebug -Xrunjdwp:transport=dt_socket,address=5005,suspend=n,server=y -Xms64m -Xmx2048m -XX:MaxPermSize=768m =true .port=1099 .authenticate=false .ssl=false 5005 (Or whatever port you configure IntelliJ with for debugging)Īdd these lines to config/tomcat-users.xml:Īdd setenv.bat (Windows) or setenv.sh to apache-tomcat/bin:.JRebel ( Download JRebel for Java | )ĭelete the existing ROOT webapp folder in tomcat if you will be deploying to ‘/’.Tomcat 7 extracted to a directory ( Apache Tomcat – Apache Tomcat 7 Downloads).These instructions are mainly for windows, but can be adapted for other operating systems. After a lot of trial and error, and frustration with lack of documentation on how this is to be done. Sometimes it’s nicer or required to develop code by deploying to a remote server. Package any property files into the jar or place them in the root scp folder for the jar to use. Debug as normal and tail log.txt for output, or whatever file log4j is set to. Port: 4001 (The debug port from the start.sh script)Ĭlick ‘Debug’ and your jar will be built, scp’d to your remote box, executed with an ssh exec of your start.sh script, and the IntellIJ debugger will connect. I had issues with the ampersands in xml, so I created a script to execute instead.Ĭreate a new Run/Debug Configuration in IntelliJ on your code box with the following params and Maven goals: You can also put the start.sh command(s) in the pom.xml file in the section. Java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=4001 -cp “C:\Program Files (x86)\ICW\” > log.txt 2>&1 & Replace log.txt with what you want to catch stdin and stderror. Use suspend=n if you don’t want to wait for the debugger. Replace 4001 with your desired debugging port (open this port in your remote box firewall). Replace the TestCron class with your main class. Replace the classpath with the root scp folder and your project’s jar artifact. Place a startup script ‘start.sh’ in the root SSH directory of your remote box: Replace the with the jar or file patterns that you wish to deploy. Replace the with your project’s target directory. Install an SSH server on your remote box.Īdd a block to settings.xml in. IntelliJ supports executing any kind of scripts or programs during a remote deploy beyond Maven commands, so you may find those easier to create and use. ![]() This method uses a Maven plugin called Wagon to upload and execute/debug a jar on another machine.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |