如何将 jar 非 osgi jar 文件添加为 eclipse 插件的依赖项? [英] How to add jar Non-osgi jar files as dependency to eclipse plugin?
问题描述
我正在使用 tycho build 开发一个 eclipse 插件,它需要一些非 osgi jar 文件作为依赖项.当我在我的 pom 文件中添加依赖项时,它在 maven 构建期间不使用依赖项.因此,我尝试使用以下插件制作一个包含所有必需依赖项的 osgi 包.
I am developing an eclipse plugin using tycho build ,It needs some non-osgi jar files as dependency.when I add the dependency in my pom file ,It does not take the dependency during maven build. So, I have tried to make a osgi bundle which contains all the required dependencies by using the following Plugin.
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.4.0</version>
<extensions>true</extensions>
<configuration>
<manifestLocation>META-INF</manifestLocation>
<instructions>
<Bundle-SymbolicName>Osgi-bundle</Bundle-SymbolicName>
<Bundle-Name>Osgi-dependency</Bundle-Name>
<Bundle-Version>1.0.0</Bundle-Version>
<Export-Package>*</Export-Package>
<Private-Package>com.foo.bundle</Private-Package>
<Bundle-Activator>com.foo.bundle.Activator</Bundle-Activator>
<Import-Package>*;resolution:=optional</Import-Package>
<Embed-Dependency>*;scope=compile|runtime;inline=true</Embed-Dependency>
<Embed-Directory>target/dependency</Embed-Directory>
<Embed-StripGroup>true</Embed-StripGroup>
<Embed-Transitive>true</Embed-Transitive>
</instructions>
</configuration>
</plugin>
之后,我已将此 osgi 捆绑包的依赖项提供给 eclipse 插件.但它仍然不接受依赖项.我已经浏览了很多站点.但是我无法在持续集成中获得这个 Maven 构建的解决方案但是,当我尝试使用现有 jar 创建新的插件项目并添加 osgi 包并导出插件时.它工作正常.但我需要 Maven 连续构建.请提供一些解决方案以将依赖项添加到 eclipse 插件项目.
After that i have provided the dependency of this osgi bundle to the eclipse plugin .But still it does not take the dependency. I have gone through lot of sites.But I am not able to get the solution for this maven build in continuous integration But,When I tried creating new plugin project with existing jar and add the osgi bundle and export the plugin .Its work fine. But I am in need to maven continuous builds. Please provide some solution to add the dependency to eclipse plugin project.
推荐答案
我已经通过创建 p2 存储库并将其部署在服务器中解决了问题.我已经创建了一个目标定义文件并将其链接到我的插件项目.
I have solved the problem by creating p2 repository and deployed it in the server.I have created a target definition file and linked it to my plugin project.
我们可以使用以下代码将非 osgi jar 转换为 p2 存储库.
We can convert non osgi jars to p2 repository by using the following code.
<build>
<plugins>
<plugin>
<groupId>org.reficio</groupId>
<artifactId>p2-maven-plugin</artifactId>
<version>1.1.2-SNAPSHOT</version>
<executions>
<execution>
<id>default-cli</id>
<configuration>
<artifacts>
<!-- specify your depencies here -->
<!-- groupId:artifactId:version -->
<artifact>
<id>org.slf4j:slf4j-log4j12:1.7.10</id>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
'
有关详细信息,此站点非常有帮助.http://www.vogella.com/tutorials/EclipseTycho/article.html#convertjars
For detailed information this site is very helpfull. http://www.vogella.com/tutorials/EclipseTycho/article.html#convertjars
这篇关于如何将 jar 非 osgi jar 文件添加为 eclipse 插件的依赖项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!