首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Tycho:分类p2元数据

Tycho:分类p2元数据
EN

Stack Overflow用户
提问于 2013-06-17 08:09:27
回答 1查看 1.4K关注 0票数 2

我试图用Tycho生成一个分类的p2存储库。主要有三个步骤(比较Eclipse文档):

  1. 下载Bundles
  2. 触发org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher
  3. 触发org.eclipse.equinox.p2.publisher.CategoryPublisher

这是我在maven pom文件中配置的。步骤1和步骤2做得很好,而步骤3失败了:

代码语言:javascript
复制
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

代码语言:javascript
复制
<?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

代码语言:javascript
复制
<?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>

如果我手动执行这些步骤,也会发生同样的错误。我遗漏了什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-06-17 14:30:53

虽然理论上可以通过Tycho调用低级别的p2操作,但对于您试图解决的问题,我不推荐这种方法。

该工件已经在Maven存储库中可用,因此您可以通过pomDependencies=consider轻松地将它添加到Tycho构建的pomDependencies=consider中。然后,您可以使用Tycho的打包类型p2构建一个带有工件的eclipse-repository存储库。

您需要下面的POM配置..。

代码语言:javascript
复制
  ...
  <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,它显式地列出了您希望包括的包:

代码语言:javascript
复制
<?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>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17142983

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档