第谷:分类p2元数据 [英] Tycho: Categorize p2 metadata

查看:97
本文介绍了第谷:分类p2元数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用Tycho生成分类的p2存储库.基本上需要完成三个步骤(比较 Eclipse文档):

  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>

如果我手动执行步骤,则会发生相同的错误.我想念什么?

解决方案

尽管从理论上讲可以通过Tycho调用低级p2动作,但对于您要解决的问题,我不推荐使用这种方法. /p>

该工件已在Maven存储库中提供,因此您可以轻松地将其添加到目标平台pomDependencies=consider构建的Tycho版本的a>.然后,例如,您可以使用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>

Iam trying to generate a categorized p2 repository with Tycho. There are basically three steps to make (compare Eclipse documentation):

  1. Download Bundles
  2. Trigger org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher
  3. Trigger org.eclipse.equinox.p2.publisher.CategoryPublisher

which i configured in a maven pom-file. Steps 1 and 2 are doing well whereas step 3 fails with:

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.]

Here is my 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>

And my 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>

If i manually execute the steps the same error occurs. What am i missing?

解决方案

Although it is theoretically possible to call the low-level p2 actions via Tycho, I wouldn't recommend this approach for the problem you are trying to solve.

The artifact is already available in a Maven repository, so you can easily add it to the target platform of a Tycho build via pomDependencies=consider. Then you can for example build a p2 repository with the artifact, using Tycho's packaging type eclipse-repository.

You'll need the following POM configuration...

  ...
  <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>

... and a category.xml which explicitly lists the bundles you want to include:

<?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>

这篇关于第谷:分类p2元数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆