问题描述
我目前正在尝试让 tycho 完成我的构建(约 30 个捆绑包).
在我的单元测试中使用 的说明.(我不确定您是否需要指定解析器).
关于 Nexus 中对 p2 存储库的支持,我的理解是 Nexus 的 p2 插件已经开源:
- Nexus - P2 存储库插件一个>
- Nexus - Bundle Maker
- nexus-p2-repository-plugin 的 Github 存储库
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-repositoryincluding 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
If mockito isn't in your target platform (and you don't have it in a p2 repository), the easiest thing to do is probably to re-add the dependency back into your pom (without removing the mockito import from your manifest).
I think you'll also need to specify the following in the pom, in the configuration for the target-platform-configuration plugin:
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<pomDependencies>consider</pomDependencies>
</configuration>
</plugin>
See the instructions on adding a dependency on a pom-first artifact. (I'm not sure whether you'll need to specify the resolver).
Regarding support for p2 repositories in Nexus, my understanding is that the p2 plugin for Nexus has since been open-sourced:
- Nexus - P2 Repository Plugin
- Nexus - Bundle Maker
- Github repository for nexus-p2-repository-plugin
这篇关于如何在 tycho 中引用 mockito?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)