/
How to Add a ClassPath in a Groovy Macro Using the Scripting for Confluence app

How to Add a ClassPath in a Groovy Macro Using the Scripting for Confluence app

Users may not see an error when an incorrect ClassPath is specified in scripting environments such as Groovy macro from the Scripting for Confluence app. This issue can lead to confusion about whether the specified jar files are being used.

Resolution Steps:

  1. Verify the ClassPath:
    Ensure the ClassPath includes the full path to each required jar file. For example:

    /path/to/confluence/WEB-INF/lib/confluence-8.5.5.jar:/path/to/confluence/WEB-INF/lib/core-8.0.1.jar

    An example path:

    /opt/atlassian/confluence/confluence/WEB-INF/lib/com.atlassian.confluence_confluence-8.6.2.jar:/opt/atlassian/confluence/confluence/WEB-INF/lib/com.atlassian.core_atlassian-core-8.0.1.jar

    i.e. add the confluence Jar followed by the core Jar path separated by colon (:) as shown above.

    2024-05-24_11-55-16-20240524-062620.png
  2. Check File Existence:
    Confirm that all jar files listed in your ClassPath actually exist in the specified locations on the server.

  3. Use Multiple Jar Files:
    If multiple jar files are needed, include them in the ClassPath separated by a colon (:).

  4. Testing and Validation:
    Currently, there is no automated validation for the ClassPath field within the macro setup. Manually test the script to ensure it executes as expected, which confirms the ClassPath is correctly set.
    Example output with correct classpath in screenshot below:

    2024-06-02_16-53-56-20240602-112412.png

 

Related content

How to Check if the Current User is a Project Lead Using JMWE Data Center
How to Check if the Current User is a Project Lead Using JMWE Data Center
Read with this
Scripting for Confluence
Scripting for Confluence
More like this
Identifying the usage of JMWE extensions in Jira DataCenter
Identifying the usage of JMWE extensions in Jira DataCenter
Read with this
How to resolve the error: Unable to load FastStringService seen in Groovy scripts with the Scripting for Confluence app
How to resolve the error: Unable to load FastStringService seen in Groovy scripts with the Scripting for Confluence app
More like this
Test a Confluence instance for macro errors with GINT configuration
Test a Confluence instance for macro errors with GINT configuration
More like this
Breaking changes 5.4.0
Breaking changes 5.4.0
More like this