问题
I haven't done a lot with Maven, but I understand the basics. We're using Tycho to build RCP plugins and I'm wondering why Tycho uses the integration-test
phase to execute the tests in a bundle.
Is it possible to bind some types of tests to the test
phase of Maven for Tycho instead of the integration-test
phase?
If so, how?
回答1:
Tycho executes tests in an OSGi container, and this requires that the compiled classes are already packed as OSGi bundles. Packing only happens in the package
phase, so the tests need to be executed later. Therefore, the tycho-surefire-plugin
by default executes tests in the integration-test
phase.
If you can run your tests as "JUnit Test" in Eclipse (instead of as "JUnit Plug-in Test"), then your code and none of your dependencies require an OSGi container. In this case, you may also be able to run the tests with the maven-surefire-plugin
. This plugin by default runs in the test
phase. I've found this blog that describes the configuration which is necessary to do this.
来源:https://stackoverflow.com/questions/28721925/is-it-possible-to-configure-tycho-surefire-to-run-in-the-test-phase