How to add a dependency to an Eclipse bundle in a Tycho build

梦想与她 提交于 2019-12-13 02:56:33

问题


I want to include org.eclipse.uml2.uml_4.0.0.v20120604-0919.jar in a Maven module. I've set up the p2 repository

<repository>
    <id>juno</id>
    <layout>p2</layout>
    <url>http://download.eclipse.org/releases/juno</url>
</repository>

and configured the Tycho build extension. Which groupdId and artifactId do I have to use so that Tycho will include org.eclipse.uml2.uml_4.0.0.v20120604-0919.jar as a dependency?


回答1:


In Tycho, you need to specify the dependencies of your plug-in in the OSGi manifest file (META-INF/MANIFEST.MF). So for the given Eclipse plugin, you would write something like

Require-Bundle: org.eclipse.uml2.uml

You cannot do the same through POM configuration.

The idea behind this is that Tycho follows the so-called Manifest-first approach. The primary configuration files for Tycho are the OSGi manifest and the other Eclipse PDE file formats (like feature.xml, *.product files, etc.).

Other tools, like the maven-bundle-plugin follow the POM-first approach of building OSGi bundles. For the maven-bundle-plugin, you'd need to specify the dependencies in the POM, and the manifest is generated accordingly.



来源:https://stackoverflow.com/questions/12406680/how-to-add-a-dependency-to-an-eclipse-bundle-in-a-tycho-build

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!