简体   繁体   English

如何在Tycho构建中向Eclipse包添加依赖项

[英]How to add a dependency to an Eclipse bundle in a Tycho build

I want to include org.eclipse.uml2.uml_4.0.0.v20120604-0919.jar in a Maven module. 我想在Maven模块中包含org.eclipse.uml2.uml_4.0.0.v20120604-0919.jar I've set up the p2 repository 我已经设置了p2存储库

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

and configured the Tycho build extension. 并配置了Tycho构建扩展。 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? 我必须使用哪个groupdIdartifactId ,以便Tycho将org.eclipse.uml2.uml_4.0.0.v20120604-0919.jar作为依赖项?

In Tycho, you need to specify the dependencies of your plug-in in the OSGi manifest file ( META-INF/MANIFEST.MF ). 在Tycho中,您需要在OSGi清单文件( META-INF/MANIFEST.MF )中指定插件的依赖关系。 So for the given Eclipse plugin, you would write something like 因此,对于给定的Eclipse插件,您可以编写类似的东西

Require-Bundle: org.eclipse.uml2.uml

You cannot do the same through POM configuration. 您不能通过POM配置执行相同操作。

The idea behind this is that Tycho follows the so-called Manifest-first approach. 这背后的想法是Tycho遵循所谓的Manifest-first方法。 The primary configuration files for Tycho are the OSGi manifest and the other Eclipse PDE file formats (like feature.xml, *.product files, etc.). Tycho的主要配置文件是OSGi清单和其他Eclipse PDE文件格式(如feature.xml,* .product文件等)。

Other tools, like the maven-bundle-plugin follow the POM-first approach of building OSGi bundles. 其他工具,如maven-bundle-plugin,遵循POM第一种构建OSGi包的方法。 For the maven-bundle-plugin, you'd need to specify the dependencies in the POM, and the manifest is generated accordingly. 对于maven-bundle-plugin,您需要在POM中指定依赖项,并相应地生成清单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM