尝试生成具有混合osgi和非osgi束的p2位点

时间:2017-01-19 22:26:38

标签: eclipse maven osgi tycho p2

我尝试使用我项目的所有传递(OSGI和非OSGI)maven依赖项创建一个p2存储库,但tycho只考虑osgi.bundle?

maven-dependency-plugin复制所有maven文件,tycho-p2-extras-plugin生成p2站点的元数据。 tycho-p2-repository-plugin使用先前下载的/target/source/plugins依赖项生成p2存储库。

<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.genstar</groupId>
    <version>1.0.0</version>
    <artifactId>genstar-bundle</artifactId>
    <packaging>pom</packaging>

    <properties>
        <tycho.version>0.26.0</tycho.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.genstar</groupId>
            <artifactId>genstar-core</artifactId>
            <version>1.0</version>
        </dependency>
    </dependencies>

    <repositories>
        <repository>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <id>bintray-anrgenstar-genstar-packages</id>
            <name>bintray</name>
            <url>http://dl.bintray.com/anrgenstar/genstar-packages</url>
        </repository>
    </repositories>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <id>copy-bundles-for-publishing</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.basedir}/target/source/plugins</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <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>
                    <includeAllDependencies>true</includeAllDependencies>
                    <compress>false</compress>
                    <append>false</append>
                    <publishArtifacts>true</publishArtifacts>
                </configuration>
            </plugin>
            <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>${project.basedir}/category.xml</categoryDefinition>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-p2-repository-plugin</artifactId>
                <configuration>
                    <includeAllDependencies>true</includeAllDependencies>
                </configuration>
                <version>${tycho.version}</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>archive-repository</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project> 

maven的项目依赖关系树:

[INFO] --- maven-dependency-plugin:3.0.0:tree (default-cli) @ genstar-bundle ---
[INFO] org.genstar:genstar-bundle:pom:1.0.0
[INFO] \- org.genstar:genstar-core:jar:1.0:compile
[INFO]    +- org.apache.logging.log4j:log4j-api:jar:2.7:compile
[INFO]    +- org.apache.logging.log4j:log4j-core:jar:2.7:compile
[INFO]    +- net.sf.opencsv:opencsv:jar:2.3:compile
[INFO]    +- org.apache.poi:poi-ooxml:jar:3.9:compile
[INFO]    |  +- org.apache.poi:poi:jar:3.9:compile
[INFO]    |  |  \- commons-codec:commons-codec:jar:1.5:compile
[INFO]    |  +- org.apache.poi:poi-ooxml-schemas:jar:3.9:compile
[INFO]    |  |  \- org.apache.xmlbeans:xmlbeans:jar:2.3.0:compile
[INFO]    |  |     \- stax:stax-api:jar:1.0.1:compile
[INFO]    |  \- dom4j:dom4j:jar:1.6.1:compile
[INFO]    |     \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO]    +- javax.vecmath:vecmath:jar:1.5.2:compile
[INFO]    +- com.thoughtworks.xstream:xstream:jar:1.4.9:compile
[INFO]    |  +- xmlpull:xmlpull:jar:1.1.3.1:compile
[INFO]    |  \- xpp3:xpp3_min:jar:1.1.4c:compile
[INFO]    +- com.vividsolutions:jts-core:jar:1.14.0:compile
[INFO]    \- com.github.yannrichet:Rsession:jar:1.8.3:compile
[INFO]       +- org.slf4j:slf4j-api:jar:1.7.12:compile
[INFO]       +- commons-io:commons-io:jar:2.4:compile
[INFO]       +- com.github.yannrichet:JMathArray:jar:1.0:compile
[INFO]       |  \- gov.nist.math:jama:jar:1.0.3:compile
[INFO]       +- org.rosuda.REngine:REngine:jar:2.1.0:compile
[INFO]       \- org.rosuda.REngine:Rserve:jar:1.8.1:compile

tycho之后由mvn clean install生成的最终存储库仅包含:

-rw-r--r-- 1 reyman reyman  50K janv. 19 23:15 genstar-core_1.0.0.jar
-rw-r--r-- 1 reyman reyman 166K janv. 19 23:15 javax.vecmath_1.5.2.jar
-rw-r--r-- 1 reyman reyman  72K janv. 19 23:15 org.apache.commons.codec_1.5.0.jar
-rw-r--r-- 1 reyman reyman 181K janv. 19 23:15 org.apache.commons.io_2.4.0.jar
-rw-r--r-- 1 reyman reyman 214K janv. 19 23:15 org.apache.logging.log4j.api_2.7.0.jar
-rw-r--r-- 1 reyman reyman 1,3M janv. 19 23:15 org.apache.logging.log4j.core_2.7.0.jar
-rw-r--r-- 1 reyman reyman  32K janv. 19 23:15 slf4j.api_1.7.12.jar
-rw-r--r-- 1 reyman reyman 537K janv. 19 23:15 xstream_1.4.9.jar

如您所见,只有一个部分(osgi包)存在,为什么?如何在maven maven-dependency-plugin下载的所有传递依赖项中包含此p2存储库?

即使是空的category.xml也会生成artifact.xml,其中包含这些似乎过滤osgi.bundle的行:s

  <mappings size='3'>
    <rule filter='(&amp; (classifier=osgi.bundle))' output='${repoUrl}/plugins/${id}_${version}.jar'/>
    <rule filter='(&amp; (classifier=binary))' output='${repoUrl}/binary/${id}_${version}'/>
    <rule filter='(&amp; (classifier=org.eclipse.update.feature))' output='${repoUrl}/features/${id}_${version}.jar'/>
  </mappings> 

如何在tycho中删除这些规则?

0 个答案:

没有答案