Intellij IDEA调试器不能用于Gradle Vert.X项目 [英] Intellij IDEA debugger not working on Gradle Vert.X project

查看:482
本文介绍了Intellij IDEA调试器不能用于Gradle Vert.X项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Vert.X 框架使用 Gradle 构建工具开发一个项目。我遇到的问题是 IntelliJ 中的断点根本无法以任何方式工作。



这里是我在Gradle中使用的 Vert.X 的运行配置:

  run {
args = [
'run',mainVerticleName,
-conf,confPath,
--redeploy = $ project.ext.watchForChange,
--launcher-class = $ mainClassName,
--on-redeploy = $ project.ext.doOnChange
]
}
Gradle
来完成部署,运行时没有任何问题,<$ c>

$ c> IntelliJ 调试程序已连接,但断点无法使用

我试过的方法让它工作:

<1> Gradle运行配置。以下是 Intellij IDEA 的运行配置:



试图使用远程调试工具,使用以下VM选项启动应用程序:
$ b -agentlib:jdwp = transport = dt_socket,server = y,suspend = n,address = 8000



但是这没有用。

2)应用程序配置:


在这种情况下,我无法启动项目,因为我在启动时收到以下消息:



错误:无法找到或加载主类io.vertx.core.Launcher < code

$ Vert.X Core 库在类路径中,并且配置似乎是c或者正确,所以不能得到是的问题。



该项目的源代码是公开的,可以在 GitHub





这是一个 IntelliJ IDEA 问题 - 参考


I'm developing a project using Vert.X framework using Gradle build tool. The problem I have is that breakpoints in IntelliJ simply doesn't work in any way I've tried.

Here is a run configuration for Vert.X which I use in Gradle:

run {
    args = [
            'run', mainVerticleName,
            "-conf", confPath,
            "--redeploy=$project.ext.watchForChange",
            "--launcher-class=$mainClassName",
            "--on-redeploy=$project.ext.doOnChange"
    ]
}

So the deployment is done using Gradle, runs without any issues, IntelliJ debugger is connected, but breakpoints are not working.

The ways I've tried to make it work:

1) Gradle run configuration. Here is a run configuration for Intellij IDEA:

Tried to use a Remote debugging tool, started application with the following VM options:

-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000

But this didn't work.

2) Application configuration:

In this case I just can't start the project as I get the following message on the startup:

Error: Could not find or load main class io.vertx.core.Launcher

Vert.X Core library is in the classpath and configuration seems to be correct, so can't get were is the problem.

The source code of the project is public and can be found on GitHub:

vertx-gradle-architecture-starter

Vert.X version - 3.4.0. Gradle version - 3.4.1. IntelliJ IDEA version - 2016.3.5. OS - MacOS Sierra 10.12.3.

Interesting fact is when I deploy Vert.X from tests - breakpoints work. Any ideas why breakpoints doesn't work in cases I've described above?

解决方案

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.

这篇关于Intellij IDEA调试器不能用于Gradle Vert.X项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆