I have several OSGi-bundles that I build with Eclipse Tycho. All code dependencies are managed manifest-first.
Now I want to develop some pure JUnit-Tests in order to test bundle-internal functionality. These tests do not need an OSGi-container in order to be executed, but they do need Mockito.
As Mockito obviously is only needed when this non-OSGi-tests are being run and not during the execution of the bundle itself, it feels wrong to add the dependency to the MANIFEST.MF file.
My current approach is that I added a project/lib-folder that holds the mockito.jar and that I added this jar to his classpath manually. This works for local eclipse execution, which is fine for the moment.
The problem is, that every coworker needs to add the jar to the classpath as well, as the .classpath-file is obviously not checked in. Also, I guess that there will be problems when the tests eventually will be executed e.g. on a build server because of the missing classpath entry.
So my question is: How can I add the dependency to Mockito in a way that will work effortless for every coworker and will not cause any problems during bundle execution?
I could add it as optional dependency to the MANIFEST.MF-file, but as stated above, it doesn't feel like thats the correct solution.
Can I add the mockito-dependency as normal pom-first dependency with scope test or will this cause conflicts with the normal manifest-first approach?
I also found the maven-eclipse-plugin which offers a classpathContainers configuration option, but I did not find a similar option to add a library to the classpath.
The tests are located in the src/test/java folder of the bundle itself.
What is the best way to add test-only dependencies to a project built with eclipse Tycho, given that I technically don't need Tycho in order to execute those tests?