Debugging Groovy Scripts
  • 21 May 2024
  • 1 Minute to read
  • Dark
    Light

Debugging Groovy Scripts

  • Dark
    Light

Article summary

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

  1. Browse to SAP Development Tools . Use the information referenced here to determine which version of Eclipse is compatible with SAP Cloud Platform Tools.

  2. Download and install the correct Eclipse version.

    Note

    Select the package for Java developers.

  3. Download and install the Eclipse plugins listed in the following table.

    ToolsDownload location
    Eclipse Groovy Development Toolshttps://github.com/groovy/groovy-eclipse/wiki
    SAP Cloud Platform Toolshttps://tools.hana.ondemand.com#cloud
    SAP Cloud Platform Integration Toolshttps://tools.hana.ondemand.com#cloudintegration

Step 2: Add the SAP server

  1. Enable the Servers view. Go to Window > Show View > Other and select Servers.
  2. Select the link in the Servers view to create a server.
  3. Select SAP > SAP Cloud Platform.
  4. In the Define a New Server panel, specify the region host for your cloud platform installation, then enter a name for the new server.
  5. Select Next.
  6. 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

  1. In the Servers view, right-click the server and select Restart in Debug.

  2. Select Groovy > Groovy Project.

  3. Name the project, then select Finish.

  4. Add the Groovy file you want to debug into the project.

    Note

    The file name must be identical to the name of the file uploaded to the system.

  5. 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.

    1. You may see a prompt advising you to switch to Debug perspective. Select Remember my decision, then select Yes.

    2. 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:

      Groovy debug point

    3. To resolve this, right-click in the Debug view, then select Edit Source Lookup.

    4. Select Add > Java Project and select the Groovy project you created earlier. The debug point should move to your Groovy file:

      Groovy debug point change


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.