【问题标题】:Tycho: Categorize p2 metadata第谷:对 p2 元数据进行分类
【发布时间】:2013-06-13 03:20:21
【问题描述】:

我正在尝试使用 Tycho 生成分类的 p2 存储库。制作基本上分为三个步骤(比较Eclipse documentation):

  1. 下载捆绑包
  2. 触发 org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher
  3. 触发 org.eclipse.equinox.p2.publisher.CategoryPublisher

我在 maven pom 文件中配置。第 1 步和第 2 步运行良好,而第 3 步失败:

Status ERROR: this code=0 publishing result null children=[Status ERROR: org.eclipse.equinox.p2.updatesite code=0 Error
generating category xml action. org.eclipse.equinox.p2.core.ProvisionException: Error reading update site file:/<path>/category.xml.]

这是我的 pom.file

<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <groupId>demo</groupId>
  <artifactId>simple-p2-repository</artifactId>
  <version>0.1.0-SNAPSHOT</version>
  <name>Simple p2 repository build</name>
  <packaging>pom</packaging>

  <properties>
    <tycho-version>0.18.0</tycho-version>
  </properties>

  <build>
    <plugins>
        <!-- Step 1 -->
        <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-bundles-for-publishing</id>
            <phase>process-resources</phase>
            <goals>
              <goal>copy</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.apache.cxf</groupId>
                  <artifactId>cxf-bundle</artifactId>
                  <version>2.7.5</version>
                </artifactItem>
              </artifactItems>
              <outputDirectory>${project.basedir}/target/source/plugins</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!-- Step 2 -->
      <plugin>
        <groupId>org.eclipse.tycho.extras</groupId>
        <artifactId>tycho-p2-extras-plugin</artifactId>
        <version>${tycho-version}</version>
        <executions>
          <execution>
            <phase>prepare-package</phase>
            <goals>
              <goal>publish-features-and-bundles</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <compress>true</compress>
          <append>true</append>
          <publishArtifacts>true</publishArtifacts>
        </configuration>
      </plugin>
      <!-- Step3 -->
      <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>tycho-p2-plugin</artifactId>
        <version>${tycho-version}</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>category-p2-metadata</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <target>${basedir}/target/repository</target>
          <categoryDefinition>${basedir}/category.xml</categoryDefinition>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

还有我的 category.xml

<?xml version="1.0" encoding="UTF-8"?>
  <site>
    <category-def name="all" label="Maven osgi-bundles"/>
    <iu>
      <category name="all"/>
      <query>
        <expression type="match">providedCapabilities.exists(p | p.namespace == 'osgi.bundle')</expression>
     </query>
   </iu>
</site>

如果我手动执行这些步骤,则会发生相同的错误。我错过了什么?

【问题讨论】:

    标签: eclipse maven eclipse-rcp tycho


    【解决方案1】:

    虽然理论上可以通过 Tycho 调用低级 p2 动作,但我不建议您尝试解决此问题。

    该工件已在 Maven 存储库中可用,因此您可以通过 pomDependencies=consider 轻松将其添加到 Tycho 构建的 target platform。然后,您可以使用 Tycho 的打包类型 eclipse-repository,例如使用工件构建 p2 存储库。

    您需要以下 POM 配置...

      ...
      <packaging>eclipse-repository</packaging>
    
      <dependencies>
        <dependency>
          <groupId>org.apache.cxf</groupId>
          <artifactId>cxf-bundle</artifactId>
          <version>2.7.5</version>
        </dependency>
      </dependencies>
    
      <build>
        <plugins>
          <plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>target-platform-configuration</artifactId>
            <version>${tycho-version}</version>
            <configuration>
              <pomDependencies>consider</pomDependencies>
            </configuration>
          </plugin>
        </plugins>
      </build>
    

    ... 和一个 category.xml 明确列出您想要包含的包:

    <?xml version="1.0" encoding="UTF-8"?>
    <site>
       <bundle id="org.apache.cxf.bundle" version="0.0.0">
          <category name="all"/>
       </bundle>
       <category-def name="all" label="Maven osgi-bundles"/>
    </site>
    

    【讨论】:

    • Tycho 目前不支持&lt;iu&gt; 语法,目前还没有人拥有requested。也许您想建议这项增强功能?
    • 嗯,这将失败并显示“缺少要求:org.apache.cxf.bundle 2.7.5 需要 'package com.ibm.wsdl.util.xml 0.0.0' 但找不到它”。 @Achim:你知道这个包在运行时应该从哪里来吗?
    • 包来自org.apache.servicemix.bundles.wsdl4j。感谢您的提示,如果它对我有用,我会试一试并报告。
    • 您还需要将 cxf 包的依赖项添加到目标平台。 Tycho 已经在构建过程中检查(传递)依赖关系是否可以解决——无论如何在运行时都需要这样做。
    • @oberlies - 前段时间我将 IU 语法报告为错误 - bugs.eclipse.org/bugs/show_bug.cgi?id=371983
    猜你喜欢
    • 1970-01-01
    • 2011-12-06
    • 2015-05-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-30
    • 2014-06-03
    • 2012-12-01
    相关资源
    最近更新 更多