如何使用intellij想法调试maven目标? [英] How to debug a maven goal with intellij idea?
问题描述
你能用 Intellij IDEA 调试一个 Maven 目标吗?我知道我可以右键单击并运行 Debug.但是,maven 插件没有出现在我的External Libraries 列表中,所以我无法进入代码并设置断点.因此,Debug 像Run 那样不间断地运行目标.
Can you debug a maven goal with Intellij IDEA? I know that I can right-click and run Debug. However, the maven plugin does not appear in my External Libraries list, so I can not go into the code and set a breakpoint. Thus, Debug runs through the goals without stopping, like Run does.
我使用的是 OS X 10.8 和 IDEA 12.0.2.
I am using OS X 10.8 and IDEA 12.0.2.
目标
我为 https://github.com/searls/jasmine-maven 编写了自定义 specRunner-plugin - 但是, $specs$ 保持为空.所以我尝试查看实际加载了哪些文件.
I've written custom specRunner for https://github.com/searls/jasmine-maven-plugin - However, $specs$ stays empty. So I try to see which files are actually loaded.
推荐答案
想通了:
- 从命令行,使用
mvnDebug
而不是mvn
运行 maven 目标.例如.mvnDebug clean
- 在intelliJ中打开你要调试的maven插件源码并设置断点
- 在IDEA中,添加一个
Remote JVM Debug
配置.
- from the command line, run maven goal with
mvnDebug
instead ofmvn
. E.g.mvnDebug clean
- Open the source of the maven plugin you want to debug in intelliJ and set a breakPoint
- In IDEA, add a
Remote JVM Debug
Configuration.
- 在设置下,设置传输:套接字,调试器模式:附加,主机:本地主机,端口:8000(mvnDebug的默认端口).
这篇关于如何使用intellij想法调试maven目标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!