The 0.2.0 release version of the Red Hat OpenShift extension for JetBrains IntelliJ is now available. You can download the OpenShift Connector extension from the JetBrains Plugins Repository. This release provides a new OpenShift: Debug action to simplify the debugging of OpenShift Components pushed to a cluster. It is similar to features developed for Visual Studio Code and JBoss Tools for Eclipse. OpenShift Connector uses OpenShift Do's (odo
's) debug command under the hood and supports only local Java and Node.js components. This enhancement lets the user write and debug local code without leaving IntelliJ.
This article explains how OpenShift: Debug works and shares the difference between debugging Java and Node.js components in IntelliJ.
How does OpenShift: Debug work?
The debug feature is still experimental and only supports Java and NodeJS components. More languages like Python will be added when odo
supports them. This action is available in the OpenShift view from the component nodes context menu. It allows developers to use IntelliJ as usual for debugging applications (set breakpoints, inspect stacks and variables, do step by step, etc.) while the application is actually running on OpenShift.
Let's see how to debug a local component, step by step:
- Download and install the OpenShift Connector from the marketplace.
- Log into an OpenShift cluster.
- If not created yet, create a project inside OpenShift.
- Create a component using a local module (or check out and use an example.)
- Create a URL to access the application inside a browser.
- Push the component.
- Place a breakpoint in the code.
- Right-click the component and select Debug.
- Wait for the local debugger to connect.
- Right-click on the URL element below the component and select Open in browser.
- Navigate to the application to reach where the breakpoint is set in the code.
Back to IntelliJ: The debugger is now active and waiting for actions.
Debug a Java component
Debugging a Java component is available in any version of IntelliJ. Simply select the Debug action on a Java component's context menu. Doing this will automatically create a new Java remote debug configuration and use it to connect to the application running on OpenShift.
Debug Node.js component
To debug a Node.js component, you need an IntelliJ version with JavaScript and Node.js support. See the version matrix on the JetBrains website for supported versions.
The same Debug action from before is used to debug a Node.js component, but this time it uses the JavaScript debugger.
Stay connected
If you want more information about this new feature, documentation is available, and you can also chat with the development team using this Gitter channel.
As always, the source code for this version is available on GitHub under the EPL license. We appreciate feedback and help for improving your developer experience, and if you have any issues or ideas, feel free to reach us on Gitter or open issues on GitHub.
Enjoy!
Last updated: June 29, 2020