Frage

I have a JRebel+Tomcat server run via IntelliJ on my Work (*NIX) machine, and occasionally I'd love to have JRebel update Classes/Resources when I'm at my home (*NIX) machine remotely connected via SSH.

e.g.

home $ ssh work
work $ cd workspace/foo/bar/baz
work $ hey-jrebel-go-update-classes

I handle this today by VNC'ing into my work machine, then in IntelliJ executing "Update Classes and Resources" on my running Tomcat instance, then log back out.

It's rather silly since I'm already SSH'd in. Is there a way to kick off this process via command-line?

War es hilfreich?

Lösung

JRebel features Remoting facility, which can be used to sync the changes via HTTP to the remote machine. For that, you should enable JRebel on remote Tomcat (via -javaagent:jrebel.jar) and enable JRebel remote plugin that create an HTTP endpoint for negotiating with the IDE plugin. -Drebel.remoting_plugin=true will do.

For more information you can check the tutorial for setting up Remoting with IntelliJ IDEA and Tomcat.

Otherwise, without remoting enabled, you can deploy the app with the rebel.xml config file which will point to the location where the exploded application is and JRebel will make Tomcat to load the resources from that specific location, so you could just synchronize from IntelliJ to that remote location via SSH. JRebel will then work as usual - monitoring the changes in the specified location and reloading the classes/resources as soon as they are being used in the application.

Andere Tipps

I'm not completely following what you are attempting to do. But if I follow, you basically want to issue a command to a remote server via SSH and, ideally, launch it from within IntelliJ IDEA. You could either:

  1. Use the Terminal window (Tools > Open Terminal), start an ssh connection, and then issue the command manually.
  2. Create an External Tool definition that uses plink (or an equivalent) to execute the ssh command to your remote server. You can create an External Tool Definition in Settings > [IDE Settings] > External Tools. See the screenshot below for an example. The definition (or its group if using groups to add structure to your definitions) will appear on the Tool menu. You can also map a shortcut to it via Settings > [IDE Settings] > Keymap > External Tools. For a multiple command sequence, you can either
    • write a local script that does it and use the External Tool definition to launch the script
    • write a remote script and use the plink in an External Tool Definition to run it
    • put the commands to run in a local file and use plink -m {file} to run them.

enter image description here

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top