Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add Mockito to the test classpath in Tycho's unit-tests with eclipse-plugin packaging

Recently, it has become possible to Execute unit-tests with eclipse-plugin packaging. And, in addition there is support for resolving JUnit Classpath Containers.

I would like to execute unit-tests with eclipse-plugin packaging, but would like to use the mockito library in addition to JUnit. I have a pomless build and would like to keep it that way. I do not want to add non-PDE files to the build, unless this is unavoidable.

Question: What is the idiomatic/intended/correct way to add this dependency, or any other test-time dependencies?

Note: I am aware of the use of fragments for unit testing. This is not what I am after. I actually want to use the new mechanism, if possible, or hear that this is currently impossible.

For my initial purposes, and given these are intended to be Unit-tests, running non-OSGI would be ok. If there is a means for OSGI as well, that would be great, but I cannot imagine where the platform configuration could be stored.

like image 570
Jörn Guy Süß Avatar asked Jan 20 '26 06:01

Jörn Guy Süß


1 Answers

See this tycho discussion, short summary:

  • you can add Mockito as an optional bundle dependency
  • you can add a M2_REPO Classpath variable reference
like image 89
Christoph Läubrich Avatar answered Jan 22 '26 23:01

Christoph Läubrich



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!