Intellij的Debug Java Gradle任务苹果硅
我使用Gradle作为构建工具在多模块Java项目上工作。我最近将硬件升级到Apple Silicon,并下载了Apple Silicon Intellij(目前使用2022.1,但在第一个硅版本上也遇到了相同的问题)。但是,当在调试模式下运行Gradle任务时,我无法设法让它停止在断点。另外,在从Intellij停止该过程之后,实际的Java进程仍在后台运行(我在重新运行上已经使用了端口错误,并且必须在Activity Monitor中停止前一个)。
我的项目结构如下:
baseModule
|- module-a
| |- submodule a1
| |- submodule a2
|- module-b
| |- submodule b1
...and so on
在基本模块中,我运行了为build..gradle中的每个模块定义的任务:
task run_a {
dependsOn gradle.includedBuild("module-a").task(":myTask")
}
in build.gradle中的模块-A中,我有以下内容:
if (findProperty("propName")) {
apply from: "propName.gradle"
}
...
<and other tasks defined>
我的propname.gradle是:
def startingPoint = "com.x.Application"
task myTask (type: JavaExec) {
description = "Run module A"
classpath = sourceSets.main.runtimeClasspath
main = startingPoint
args = ['development']
}
运行run_a任务时在硅Intellij中,调试不起作用,终止任务后我有悬挂过程。当我使用基于Intel的旧Intellij运行时,我没有任何问题。
关于如何解决此问题的任何建议?如果我直接在prepname.gradle
中直接在build.gradle.gradle
module-a
中添加任务,我可以在硅版本中进行调试。它直接从那里作为一个单独的任务,而无需使用run_a
在baseModule
中定义的任务。
I work on a multi module Java project using Gradle as the build tool. I recently upgraded my hardware to Apple Silicon and downloaded the Apple Silicon IntelliJ (currently using 2022.1, but also had the same problem on the first silicon version). However, when running gradle tasks in debug mode I can't manage to get it to stop at breakpoints. Also, after stopping the process from IntelliJ, the actual java process is still running in the background (I get port already used errors on rerun and have to stop the previous one from Activity Monitor).
My project structure is as following:
baseModule
|- module-a
| |- submodule a1
| |- submodule a2
|- module-b
| |- submodule b1
...and so on
In the baseModule I have run tasks defined for each module in the build.gradle:
task run_a {
dependsOn gradle.includedBuild("module-a").task(":myTask")
}
In module-a in the build.gradle I have the following:
if (findProperty("propName")) {
apply from: "propName.gradle"
}
...
<and other tasks defined>
My propName.gradle is:
def startingPoint = "com.x.Application"
task myTask (type: JavaExec) {
description = "Run module A"
classpath = sourceSets.main.runtimeClasspath
main = startingPoint
args = ['development']
}
When I run the run_a task in the Silicon IntelliJ, debugging doesn't work and I have hanging processes after terminating the task. When I run using a older Intel based IntelliJ, I have no issues.
Any suggestions on how to fix this issue? I can debug fine in the Silicon version if I add the task from propName.gradle
directly in the build.gradle
of module-a
and run it from there directly as a separate task, without using the run_a
task defined in the baseModule
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论