You can use Liferay Developer Studio to debug Liferay DXP source code to help resolve errors. Debugging Liferay DXP code follows most of the same techniques associated with debugging in Eclipse. If you need some 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.
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 Developer Studio. See the Managing the Target Platform for 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 Developer Studio. See the Installing a Server in Liferay Developer Studio for more details.
-
Start the server in debug mode. To do this, click the debug button in the Servers pane of Liferay Developer Studio.
Awesome! You’re now equipped to begin debugging in Liferay Developer Studio!