Mikhail,
Thanks for the response.
If you insist on keeping this design, I don't see other alternatives
than replacing ImportPackage stanza with RequireBundle one in
MANIFEST.MF.I thought of doing this, but it makes my WebService bundle more tightly coupled to my DAO bundle. I was using Spring to inject the DAO as an OSGI Service into my WebServices bundle.
I think, Tycho would not like it if two different bundles
provided the same package, and would print an error, but maybe it just
prints a warning and picks one of them. In other words, if you think
that a wrong bundleX is picked up, it's because that bundleX is in the
target platform for bundleY and because it satisfies some requirement of
bundleY.This is where I have tried to maintain a balance between the pde workspace and Tycho. I can run my unit tests from the pde using the JunitPluginTest and selecting all of the needed plugins for the run configuration. I needed to do something similar for the Tycho Surefire plugin. I could ensure that it included and started my DAO bundle with the mock implementations.
When running my product from eclipse, I can do the same in my run configuration and ensure that my DAO bundle with the SpringData implementations is included.
Btw, one common way to package tests with tycho is to make test bundle a
fragment of host bundle, but I don't have much experience with Spring
and don't know if it blends well.I tried to make it a fragment at first, but I had to move it to a standalone bundle due to loading and timing issues in the spring framework. I do have some integration tests that work when used as a fragment.
I may need to rethink my architecture some what, but the approach worked ok until it didn't ( if you know what I mean ). Basically to get around it, I had to make sure that the Mock one and the Spring Data one had
EXACTLY the same methods and method signatures that are referenced in the WebServices bundle. I was off a little on only one DAO interface. I am just a little worried that my Spring Data Repositories might now be completely implemented if it is compiling against the more stripped down bundle.