2014-10-31 195 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> 

然后,束在安装的时候解预期。

相关问题