Top Menu

Jump to content
Home
    • Projects
    • Work packages
    • News
    • Getting started
    • Introduction video
      Welcome to OpenProject
      Get a quick overview of project management and team collaboration with OpenProject. You can restart this video from the help menu.

    • Help and support
    • Upgrade to Enterprise edition
    • User guides
    • Videos
    • Shortcuts
    • Community forum
    • Professional support

    • Additional resources
    • Data privacy and security policy
    • Digital accessibility (DE)
    • OpenProject website
    • Security alerts / Newsletter
    • OpenProject blog
    • Release notes
    • Report a bug
    • Development roadmap
    • Add and edit translations
    • API documentation
  • Sign in
      Forgot your password?
      Create a new account

Side Menu

  • Overview
  • Roadmap
  • Work packages
  • News
  • Wiki
    • Table of contents
      • Hierarchy leafAI Tools for Development
      • Hierarchy leafDeployment To the Server(Modified)
      • Hierarchy leafHosting BTCPayServer in Linux server
      • Hierarchy leafHow to overcome bitbucket login problem (Windows)
      • Expanded. Click to collapseCollapsed. Click to showInstalling a project in Elintegro
        • Hierarchy leafPipeline setUp for Bitbucket
      • Expanded. Click to collapseCollapsed. Click to showInterview University
        • Expanded. Click to collapseCollapsed. Click to showDocker: Install an Elintegro App within Linux server
          • Hierarchy leafConnect to Docker of Omnipay
      • Expanded. Click to collapseCollapsed. Click to showKafka Installation Guide
        • Expanded. Click to collapseCollapsed. Click to showComparing Kafka with other topic technologies
          • Hierarchy leafDesign a messaging app, high level, using kafka
      • Hierarchy leafOpen Project
      • Hierarchy leafRebase with Development Branch
      • Hierarchy leafRemote Debugger with IntelliJ
      • Hierarchy leafTelegram API
      • Hierarchy leafUpgrading Elintegro apps to Grails 6
You are here:
  • Remote Debugger with IntelliJ

Content

Remote Debugger with IntelliJ

  • More
    • Table of contents

To configure a Grails 3 application for remote debugging, you need to make adjustments to the application's startup scripts. Here's a step-by-step guide:

1. Edit BuildConfig.groovy:

Open the `BuildConfig.groovy` file in the root of your Grails 3 project, and add the following lines inside the `dependencies` block:

groovy:
  
  dependencies {
      // other dependencies...

compile 'org.grails.plugins:grails-debug:3.0.0'
  }
  

This will add the Grails Debug Plugin to your project.

2. Configure the debug port:

Open the `grails-app/conf/application.yml` file and add the following configuration for the debug port. If the `application.yml` file doesn't exist, create one.

  grails:
      debug:
          enabled: true
          port: 5005

This sets the debug port to 5005. You can choose a different port if needed.

3. Run your application in debug mode:

Open a terminal and navigate to your project's root directory. Run the following command:

  ./gradlew bootRun --debug-jvm
  
  If you are on Windows, use `gradlew.bat` instead of `./gradlew`:
  
  gradlew.bat bootRun --debug-jvm

4. Publish Remote Debuger's Port in deploy script

Make changes to deploy.sh file by adding --publish 5005:5005 argument to the docker run command:

docker run --publish 8088:8080 --publish 5005:5005 --detach --name dev-omnipaycoinatm omnipaycoinatm-dev

5. Connect your debugger:

In your favorite IDE (such as IntelliJ IDEA or Eclipse), create a remote debugging configuration:

- IntelliJ IDEA:

  • Go to Run > Edit Configurations, click on the "+" icon, and choose "Remote" from the list.
  • Set the host to `localhost` or the remote host your application is running on
  • Set the port to `5005` (or the port you specified in the configuration).
  • That will generate the following in the "Command line arguments for remote JVM" field:
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005

- Eclipse:

  • Go to Run > Debug Configurations, right-click on "Remote Java Application," and choose "New."
  • Set the host to `localhost` and the port to `5005` (or the port you specified in the configuration).

Now, you can start the remote debugger from your IDE. It will connect to your Grails application, allowing you to set breakpoints, inspect variables, and debug your code.

Remember to remove or disable the debug configuration in a production environment and only use it for development purposes.

Loading...