I'm currently trying to get my build (~30 bundles) done by tycho.
I faced some confusing problems when using Mockito in my unit tests.
I created an eclipse-test-plugin
as fragment project to the tested bundle.
Since tycho should resolve the required bundles using the manifest, I removed the dependency to mockito from the pom.xml
.
When I then try to add mockito to the required bundles in the manifest mockito isn't listed.
I found this post and created a target platform pointing to eclipse indigo.
I included the platform specifics so I don't need the eclipse delta pack. Then the first strange thing occurs. Eclipse is telling me that there are some unsatisfiably dependencies and when I set the newly created target platform as active within eclipse, no more packages like org.osgi.framework
, etc. can be resolved by eclipse. But when I build an eclipse-product
using tycho and the target platform it is working.
If I set the current eclipse installation as active platform the bundles are resolved. I've selected the following of the indigo release:
- Eclipse RCP Plug-in Developer Resources
- Equinox Target Components
- Jetty Target Components
So my first question is "What is wrong with my target-platform so that tycho is able to use it but eclipse isn't?"
To get closer to my original problem (getting mockito running) I set the current eclipse installation as the active target platform. Eclipse then can resolve the org.osgi.framework
package and others.
I added then the previously removed dependency to mockito again to my pom.xml
like in the above-mentioned post. But I still can't find mockito when I try to add it to the required bundles in the manifest.
So my second question is "What am I doing wrong? How do you reference bundles that are not published at the eclipse update site, e.g. the maven central repository?"
Update: During my research I found two ways of including bundles from non-p2-update-sites in my target-platform:
- Nexus Pro
The professional version of Nexus supports p2-Proxy repositories which can wrap default maven repositories like the Maven Central Repository into a p2 update-site, but the professional version costs round about $800 per year. - Create an eclipse-repository
You can create a new maven project with packagingeclipse-repository
including all your desired bundles. The created artifact is then deployed to a common web server.
In your target-platform you can then reference the Nexus p2-proxy repo or the web hosted p2-repo.
Does anyone know other ways - probably more convenient/less expensive?
Please help me understand the confusing world of tycho a bit more...
Thanks in advance
p2-maven-plugin
- https://mcmap.net/q/829311/-dependencies-from-pom-xml-not-considered-by-eclipse-in-tycho-project – Wizen