如何添加jar非osgi jar文件作为依赖eclipse插件? [英] How to add jar Non-osgi jar files as dependency to eclipse plugin?

查看:188
本文介绍了如何添加jar非osgi jar文件作为依赖eclipse插件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用tycho build开发一个eclipse插件,它需要一些非osgi jar文件作为依赖关系。当我在pom文件中添加依赖关系时,它不会在maven构建过程中依赖。
所以,我试图通过使用以下插件来制作一个包含所有必需依赖项的osgi包。

  <插件> 
< groupId> org.apache.felix< / groupId>
< artifactId> maven-bundle-plugin< / artifactId>
< version> 1.4.0< / version>
< extensions> true< / extensions>
< configuration>
< manifestLocation> META-INF< / manifestLocation>
<指令>
< Bundle-SymbolicName> Osgi-bundle< / Bundle-SymbolicName>
< Bundle-Name> Osgi依赖关系< / 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:=可选< / 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包和导出插件。它工作正常。但是我需要不断的建立。
请提供一些解决方案来添加eclipse插件项目的依赖。

解决方案

我已经通过创建p2来解决问题存储库并将其部署在服务器中。我已经创建了一个目标定义文件并将其链接到我的插件项目。



我们可以将非osgi jar转换为p2仓库,方法是使用以下代码。

 < build> 
< plugins>
< plugin>
< groupId> org.reficio< / groupId>
< artifactId> p2-maven-plugin< / artifactId>
< version> 1.1.2-SNAPSHOT< / version>
<执行>
< execution>
< id> default-cli< / id>
< configuration>
<工件>
<! - 在这里指定您的关系 - >
<! - 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


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>

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.

解决方案

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.

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>

'

For detailed information this site is very helpfull. http://www.vogella.com/tutorials/EclipseTycho/article.html#convertjars

这篇关于如何添加jar非osgi jar文件作为依赖eclipse插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆