如何使用intellij想法调试maven目标? [英] How to debug a maven goal with intellij idea?

查看:30
本文介绍了如何使用intellij想法调试maven目标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你能用 Intellij IDEA 调试一个 Maven 目标吗?我知道我可以右键单击并运行 Debug.但是,maven 插件没有出现在我的External Libraries 列表中,所以我无法进入代码并设置断点.因此,DebugRun 那样不间断地运行目标.

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.

推荐答案

想通了:

  1. 从命令行,使用 mvnDebug 而不是 mvn 运行 maven 目标.例如.mvnDebug clean
  2. 在intelliJ中打开你要调试的maven插件源码并设置断点
  3. 在IDEA中,添加一个Remote JVM Debug配置.
  1. from the command line, run maven goal with mvnDebug instead of mvn. E.g. mvnDebug clean
  2. Open the source of the maven plugin you want to debug in intelliJ and set a breakPoint
  3. In IDEA, add a Remote JVM Debug Configuration.
  1. 在设置下,设置传输:套接字,调试器模式:附加,主机:本地主机,端口:8000(mvnDebug的默认端口).

  • 在调试模式下运行配置.它应该连接到等待的 mvnDebug jvm.
  • 这篇关于如何使用intellij想法调试maven目标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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