JetBrains IntelliJ Red Hat OpenShift extension provides debug support for OpenShift components
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
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.