- 21 May 2024
- 1 Minute to read
- Print
- DarkLight
Debugging Groovy Scripts
- Updated on 21 May 2024
- 1 Minute to read
- Print
- DarkLight
Use Eclipse and Eclipse plugins to debug Groovy scripts that are deployed on a cloud system.
Prerequisites
Download and install a Java Development Kit (JDK).
Step 1: Download tools and plugins
Browse to SAP Development Tools . Use the information referenced here to determine which version of Eclipse is compatible with SAP Cloud Platform Tools.
Download and install the correct Eclipse version.
NoteSelect the package for Java developers.
Download and install the Eclipse plugins listed in the following table.
Tools Download location Eclipse Groovy Development Tools https://github.com/groovy/groovy-eclipse/wiki SAP Cloud Platform Tools https://tools.hana.ondemand.com#cloud SAP Cloud Platform Integration Tools https://tools.hana.ondemand.com#cloudintegration
Step 2: Add the SAP server
- Enable the Servers view. Go to Window > Show View > Other and select Servers.
- Select the link in the Servers view to create a server.
- Select SAP > SAP Cloud Platform.
- In the Define a New Server panel, specify the region host for your cloud platform installation, then enter a name for the new server.
- Select Next.
- Enter server information and your SAP account credentials, then select Finish. The SAP Cloud Platform server appears in the Servers view.
Step 3: Debug the SAP server
In the Servers view, right-click the server and select Restart in Debug.
Select Groovy > Groovy Project.
Name the project, then select Finish.
Add the Groovy file you want to debug into the project.
NoteThe file name must be identical to the name of the file uploaded to the system.
Open the Groovy file and place a debug point on it. Then trigger script execution from the cloud system. Processing should be halted at the debug point in Eclipse so you can then debug the script.
You may see a prompt advising you to switch to Debug perspective. Select Remember my decision, then select Yes.
The first time, the debug point will arrive at a byte code file instead of the Groovy file in your project, as shown in the following sample:
To resolve this, right-click in the Debug view, then select Edit Source Lookup.
Select Add > Java Project and select the Groovy project you created earlier. The debug point should move to your Groovy file: