Intellij IDEA debugger not working on Gradle Vert.X project

我怕爱的太早我们不能终老 提交于 2019-11-30 10:20:44
Yuriy Yunikov

Here are solutions to both issues. Thanks to @CrazyCoder for help on this.

1) run command is run in separate VM. So, to make it work, I've added --java-opts argument to the script:

run {
    args = [
            'run', mainVerticleName,
            "-conf", confPath,
            "--redeploy=$project.ext.watchForChange",
            "--launcher-class=$mainClassName",
            "--on-redeploy=$project.ext.doOnChange",
            // used for attaching remote debugger
            "--java-opts", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000"
    ]
}

This allows to attach Remote debug configuration on port 8000.

2) By default, Intellij IDEA creates separate modules per source sets, so I had source sets for api_main and api_test modules. After turning off this feature - Application debug run started to work.

This can be turned off in Gradle Settings. Preferences -> Build, Execution, Deployment -> Build Tools -> Gradle: uncheck create separate modules per source set.

This is an IntelliJ IDEA issue - reference.

I had the exact same issue and following worked for me. redeploy, launcher and on-redeploy options are not necessary in intelliJ. if we remove those the debug works after application is up.

run {
    args = [
        'run', mainVerticleName,
        "-conf", confPath
    ]
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!