【发布时间】:2012-03-31 23:40:24
【问题描述】:
当使用 Tycho 构建项目时,测试用例在新进程中运行,使用 Equinox 启动器运行 -application org.eclipse.tycho.surefire.osgibooter.headlesstest。
如何调试测试用例?
【问题讨论】:
标签: java remote-debugging tycho tycho-surefire-plugin
当使用 Tycho 构建项目时,测试用例在新进程中运行,使用 Equinox 启动器运行 -application org.eclipse.tycho.surefire.osgibooter.headlesstest。
如何调试测试用例?
【问题讨论】:
标签: java remote-debugging tycho tycho-surefire-plugin
有一种更简单的方法可以做到这一点:
只需将-DdebugPort=8000 添加到您的 Maven 命令行并附加远程调试会话。
请参阅文档https://www.eclipse.org/tycho/sitedocs/tycho-surefire-plugin/test-mojo.html#debugPort
【讨论】:
将此添加到您的 POM:
<profiles>
<profile>
<id>debug</id>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<argLine>-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y</argLine>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
现在您可以在打印以下行时使用mvn ... -P debug 启用调试:
在地址:8000 监听传输 dt_socket
【讨论】: