You can debug Liferay DXP source code in Dev Studio to help resolve errors. Debugging Liferay DXP code follows most of the same techniques associated with debugging in Eclipse. If you need help with general debugging, you can visit Eclipse’s documentation. Here’s some helpful Eclipse links to visit:
There are a couple Liferay-specific configurations to know before debugging Liferay DXP code:
Let’s explore these Liferay-specific debugging configurations.
Configure Your Target Platform
To configure your target platform, you must be developing in a
Liferay Workspace.
Liferay Workspace is able to provide debugging capabilities by targeting a
specific Liferay DXP version, which indexes the configured Liferay DXP source code.
Liferay Workspace does not perform portal source indexing by default. You must
enable this functionality by adding the following property to your workspace’s
gradle.properties
file:
target.platform.index.sources=true
Without specifying a target platform, Liferay DXP’s source code cannot be accessed by Dev Studio. See the Managing the Target Platform in Liferay Workspace tutorial for more information on how this works.
Important: The target platform should match the Liferay server version you configure in the next section.
Once the target platform is configured in your workspace, Eclipse has access to all of Liferay DXP’s source code. Next, you’ll configure a Liferay server and learn how to start it in Debug mode.
Configure a Liferay Server and Start It in Debug Mode
Configuring your target platform gives Eclipse Liferay DXP’s source code to reference. Now you must configure a Liferay server matching the target platform version so you can deploy the custom code you wish to debug.
-
Set up your Liferay DXP server to run in Dev Studio. See the Installing a Server in Dev Studio for more details.
-
Start the server in debug mode. To do this, click the debug button in the Servers pane of Dev Studio.
Awesome! You’re now equipped to begin debugging in Liferay Dev Studio!