是否可以在测试阶段将tycho-surefire配置为运行?

Is it possible to configure tycho-surefire to run in the test phase?

我对 Maven 的了解不多,但我了解基础知识。我们正在使用 Tycho 构建 RCP 插件,我想知道为什么 Tycho 使用 integration-test 阶段来执行捆绑包中的测试。

是否可以将某些类型的测试绑定到 Maven for Tycho 的 test 阶段而不是 integration-test 阶段?

如果是,怎么做?

Tycho 在 OSGi 容器中执行测试,这要求编译的 类 已经打包为 OSGi 包。打包仅发生在 package 阶段,因此需要稍后执行测试。因此,tycho-surefire-plugin 默认在 integration-test 阶段执行测试。

如果您可以 运行 您的测试作为 "JUnit Test" 在 Eclipse 中(而不是 "JUnit Plug-in Test"),那么您的代码和 none 您的依赖项需要一个 OSGi 容器.在这种情况下,您还可以 运行 使用 maven-surefire-plugin 进行测试。这个插件默认在 test 阶段 运行s。我发现 this blog 描述了执行此操作所需的配置。