我正在開發一個Eclipse插件,並希望利用SpringSource上承載的Jersey OSGI捆綁包,但一旦捆綁被拉下,它就不會被使用。我的問題是,如何在POM或MANIFEST中聲明我希望將Jersey包作爲依賴項來使用?Eclipse插件項目不消耗OSGI捆綁依賴關係
我的項目由一個簡單的更新站點,一個包含插件的特性和插件本身組成,都是在本書後面創建的:「按示例初學者指南進行Eclipse 4插件開發」。我使用Tycho作爲我的構建工具,使用父POM將目標平臺信息和其他項目作爲模塊。
我父POM低於:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.inin.testing.eclipse</groupId>
<artifactId>com.inin.testing.eclipse.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<tycho-version>0.18.1</tycho-version>
<eclipse>http://download.eclipse.org/releases/kepler</eclipse>
</properties>
<modules>
<module>com.inin.testing.eclipse.update</module>
<module>com.inin.testing.eclipse.feature.testcase</module>
<module>com.inin.testing.eclipse.plugin.tcdb</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho-version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<resolver>p2</resolver>
<pomDependencies>consider</pomDependencies>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>kepler</id>
<layout>p2</layout>
<url>${eclipse}</url>
</repository>
<repository>
<id>com.springsource.repository.bundles.release</id>
<name>SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases</name>
<url>http://repository.springsource.com/maven/bundles/release</url>
</repository>
<repository>
<id>com.springsource.repository.bundles.external</id>
<name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name>
<url>http://repository.springsource.com/maven/bundles/external</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jdt</groupId>
<artifactId>core</artifactId>
<version>3.3.0-v_771</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>com.springsource.com.sun.jersey</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
</project>
插件POM是如下:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.inin.testing.eclipse</groupId>
<artifactId>com.inin.testing.eclipse.update</artifactId>
<version>1.0.1-SNAPSHOT</version>
<packaging>eclipse-repository</packaging>
<parent>
<groupId>com.inin.testing.eclipse</groupId>
<artifactId>com.inin.testing.eclipse.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
</project>
我還添加清單項的插件項目上的SpringSource給出:
Import-Bundle: com.springsource.com.sun.jersey;version="[1.0.0,1.0.0]"
當我用tycho構建時沒有錯誤,但我無法使用任何應該是用Jersey捆綁包導入。
我已經嘗試將Jersey依賴項從父項移動到具有相同結果的子項目POM。也許解決方案非常明顯,我看不到它,或者我處在完全錯誤的軌道上。任何幫助都會很棒。謝謝!