How to develop your IntelliJ IDEA plugins even faster with JRebel

Back in my NetBeans times I wrote several articles (1, 2) about using Zeroturnarounds JRebel to develop NetBeans plugins faster by not restarting nor reloading the whole target-platform. JRebel is a Java agent, so it can be used with nearly every Java-based application. Even for developing IDEA plugins. And here is how you do it:

One-Time-Setup

  1. Buy a JRebel license or get a free one for your open-source plugin at myRebel
  2. Install the JRebel plugin for IDEA from the plugin manager (for bundling JRebel, a configuration UI and debugging support)
  3. Activate the plugin using the license from step 1
  4. Update the your Run- or Debug configuration with the Java agent configuration – based on the standard documentation)
    For example: -agentpath:/Users/markiewb/Downloads/jrebel/lib/libjrebel64.dylib
    runconfiguration

Every-day-workflow

  1. Run / debug your plugin using the configuration created above – JRebel should show its banner and an IDEA instance should load
    banner
  2. Edit your Java sources as normal and when you want to get the changes reloaded then compile the project/all the changed files (thus the sources are compiled into class-files and JRebel can pick up the changes)
  3. Reinvoke your plugins actions (or what ever) in the target platform – your changes should be picked up

Notes

Note 1 Not all changes will be picked up. JRebel does not have yet official support for this usage scenario. Especially changes in the plugin.xml won’t be picked up. But within existing or new Java classes you can code and refactor as much as you like!

Note 2 If you are on Mac OS consider to install JRebel separately. I had issues to set the Java agent with the bundled JRebel from the JRebel IDE plugin. Do you see the culprit in -agentpath:/Users/markiewb/Library/Application Support/IntelliJIdea2017.2/jr-ide-idea/lib/jrebel6/lib/libjrebel64.dylib? The whitespace!

Note 3 Of course this also works when you write plugins for the other Java based IntelliJ platform IDEs like WebStorm, PHPStorm and so on.

Advertisements

IDEA: Navigator plugin for GWT

Within the last two days I wrote a new plugin, which allows you to jump faster between files of GWT services.

Using IDEAs “Related symbols” action you can jump from the async method in the interface to its implementation and vice-versa – all based on filename conventions and it is nice example of a GotoRelatedProvider.

Here you jump between files:

Here you jump between methods of files:

https://plugins.jetbrains.com/plugin/9912-navigator-extension-for-google-web-toolkit

This plugin requires the community edition of IntelliJ IDEA.

IDEA: External Tools as a Run Configuration?

Try the Run Configuration For External Tools-plugin.

RunPopup.png

The idea of an empty run configuration type is also provided by Batch Scripts Support– or BashSupport-plugin. So if you already use one of the bash plugins, you do not need my plugin.

IDEA: Build your own Tomcat integration for the free IntelliJ IDEA Community Edition

If you are using the free Community Edition of IntelliJ IDEA you probably noticed that there is no Tomcat support. The integration is included only in the commercial Ultimate Edition.

If won’t buy a license for whatever reason, you still can create some basic Tomcat integration even in the free IDEA Community Edition.

How to start the Tomcat from within the IDE?

Create an ‘External Tool’ configuration for the Tomcat
2017-06-04_12h50_00.png
The command is catalina jpda run to start the tomcat in debug mode at the default port 8000.

Now the Tomcat can be started from several places within the IDE

2017-06-04_14h11_50.png

and even the output of the process is printed to its run console.

2017-06-04_12h53_12.png

Tip: If you want the External Tool to be integrated as a Run Configuration please checkout the other post and plugin.

How to start a debug session for started Tomcat?

Create a run configuration which starts a remote debugging session at localhost:8000

2017-06-04_14h38_58.png

Switch to ‘Logs’ tab and configure that the log files are also integrated2017-06-04_13h04_52.png

After starting the run configuration, the debugger is attached to the Tomcat and the log files of the tomcat are shown within the IDE.

2017-06-04_13h07_01.png

How to deploy a WAR file from a Maven based webapp to the Tomcat?

The steps are to run mvn war:war first to create the WAR and then to copy it to the webapp directory of the Tomcat.

One approach is to create a ‘Maven’ run configuration with the commandline: war:war org.codehaus.mojo:wagon-maven-plugin:upload-single -Dwagon.fromFile=FULL_PATH_TO_WAR_FILE -Dwagon.url=file://FULL_PATH_TO_TOMCAT\webapps\ (Don’t forget to change placeholders!)

This creates the WAR file and copies it to the Tomcat via the wagon-maven-plugin.
2017-06-04_15h28_01.png

Other approaches could be:

  • Create a batch script (which invokes maven and copies the WAR), integrate it as an ‘External Tool’ configuration OR
  • Use the remote synchronizer plugin OR
  • Integrate an Ant target to copy the file OR
  • … more ideas at stackoverflow or here

Alternatives