2014-10-31 198 views
0

我有大量來自舊版Eclipse RCP應用程序的包,我希望能夠在Tycho構建中使用。這些軟件包還沒有p2版本庫,所以我創建了一個。除了需要在安裝中解壓縮的包仍然作爲JAR安裝之外,這已經工作得很好。如何使Eclipse在沒有Eclipse-BundleShape標頭的情況下解壓縮包

我創建p2存儲庫的第一種方法是將捆綁包部署到Maven存儲庫,然後使用pomDependency =考慮將它們包含在eclipse-featureeclipse-repository中。但是,Tycho忽略feature.xml中的unpack屬性,所以這不起作用(參見documentation)。針對此問題的推薦解決方案是在所包含的軟件包的清單中添加Eclipse-BundleShape: dir。我可以做到這一點 - 但由於我有數百捆,這將是一個相當大的努力。

然後,我得到了使用「功能和捆綁發佈者應用程序」的提示:使用此應用程序,功能和捆綁工件同時在p2存儲庫中創建,因此有關捆綁形狀的信息可以從feature.xml複製到相應的包中。

然而,這仍然無法正常工作:雖然我已經設置unpack="true"的束中的一個被公佈的,捆不具備

<instruction key='zipped'> 
    true 
</instruction> 

在P2存儲庫中的content.xml因此在安裝時不會打開包裝。任何想法我可能做錯了什麼?任何其他想法如何得到這個工作?


這是P2存儲庫創建我的pom.xml

<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"> 
    <modelVersion>4.0.0</modelVersion> 

    <groupId>com.mycorp.xyz.expose</groupId> 
    <artifactId>com.mycorp.xyz.expose.orbit</artifactId> 
    <version>1.0.0</version> 

    <dependencies> 
     <dependency> 
      <groupId>com.mycorp.xyz.expose</groupId> 
      <artifactId>com.mycorp.somelib</artifactId> 
      <version>6.40.0</version> 
     </dependency> 
     <!-- and many more... --> 
    </dependencies> 

    <build> 
     <outputDirectory>${project.build.directory}/artifacts</outputDirectory> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-dependency-plugin</artifactId> 
       <version>2.9</version> 
       <executions> 
        <execution> 
         <id>copy</id> 
         <phase>process-resources</phase> 
         <goals> 
          <goal>copy-dependencies</goal> 
         </goals> 
         <configuration> 
          <outputDirectory>${project.build.directory}/artifacts/plugins</outputDirectory> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 
      <plugin> 
       <groupId>org.eclipse.tycho.extras</groupId> 
       <artifactId>tycho-p2-extras-plugin</artifactId> 
       <version>0.21.0</version> 
       <executions> 
        <execution> 
         <id>publish-features-and-bundles</id> 
         <phase>compile</phase> 
         <goals> 
          <goal>publish-features-and-bundles</goal> 
         </goals> 
         <configuration> 
          <sourceLocation>${project.build.directory}/artifacts</sourceLocation> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 
      <plugin> 
       <groupId>org.eclipse.tycho</groupId> 
       <artifactId>tycho-p2-repository-plugin</artifactId> 
       <version>0.21.0</version> 
       <executions> 
        <execution> 
         <id>assemble</id> 
         <phase>package</phase> 
         <goals> 
          <goal>verify-repository</goal> 
          <goal>archive-repository</goal> 
         </goals> 
        </execution> 
       </executions> 
      </plugin> 
     </plugins> 
    </build> 
</project> 

該項目的唯一的其他文件如下feature.xml的中的src/main /資源/功能「:

<?xml version="1.0" encoding="UTF-8"?> 
<feature 
     id="com.mycorp.xyz.expose.orbit" 
     label="..." 
     version="1.0.0"> 

    <plugin 
     id="com.mycorp.somelib" 
     download-size="0" 
     install-size="0" 
     version="0.0.0" 
     unpack="true"/> 

    <!-- and many more... --> 

</feature> 
+0

這是一個非常好的問題(幾乎完美的解決方案),我今天在內部得到了。我分享給他人從這個問題和答案中受益。 – oberlies 2014-10-31 15:07:15

回答

1

我已經調試了所描述的s中運行的功能和Bundle Publisher應用程序etup,事實證明,發佈者不會將feature.xml中的unpack="true"與捆綁關聯,因爲版本不匹配。

因此,您需要在feature.xml中提供引用包的實際OSGi版本,而不是0.0.0。沒有像在正常的第谷構建自動更換。因此,feature.xml例如是這樣的:

<?xml version="1.0" encoding="UTF-8"?> 
<feature 
     id="com.mycorp.xyz.expose.orbit" 
     label="..." 
     version="1.0.0"> 

    <plugin 
     id="com.mycorp.somelib" 
     download-size="0" 
     install-size="0" 
     version="6.40.0.140829051758" 
     unpack="true"/> 

</feature> 

然後,束在安裝的時候解預期。

相關問題