是否有可能让tycho-p2-director-plugin的物化产品目标包含源功能?

时间:2018-03-07 00:57:07

标签: eclipse eclipse-rcp rcp tycho

我正在使用tycho-source-plugin和tycho-source-feature-plugin来生成插件源jar和源代码功能。

我正在使用tycho-p2-repository-plugin和使用tycho-p2-director-plugin的产品生成p2存储库。

对于p2存储库,我可以通过添加category.xml并将“.source”附加到所有功能的id来包含源jar。

对于该产品,我找不到任何有关如何将物化产品包含在物化产品或产品档案中的文档或示例。

有可能吗?

1 个答案:

答案 0 :(得分:1)

我今天在工作中偶然发现了这一点。 抱歉,此操作无法恢复,但这可能对某人有所帮助。

它对我有用的方法是在产品文件中指定源功能,然后让tycho从现有功能中生成源和源功能。

产品文件:

<feature id="com.some.feature" installMode="root"/>
<feature id="com.some.feature.source" installMode="root"/>

在提供源代码的“ API”捆绑包中,我将其添加到pom.xml中:

<build>
    <plugins>
        <plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>tycho-source-plugin</artifactId>
            <version>${tycho-version}</version>
            <executions>
                <execution>
                    <id>doc</id>
                    <goals>
                        <goal>plugin-source</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

我创建了一个引用该捆绑软件的功能项目。在该项目的pom.xml中,我添加了:

<build>
    <plugins>
        <plugin>
            <groupId>org.eclipse.tycho.extras</groupId>
            <artifactId>tycho-source-feature-plugin</artifactId>
            <version>${tycho-version}</version>
            <executions>
                <execution>
                    <id>doc</id>
                    <goals>
                        <goal>source-feature</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>tycho-p2-plugin</artifactId>
            <version>${tycho-version}</version>
            <executions>
                <execution>
                    <id>attached-p2-metadata</id>
                    <phase>package</phase>
                    <goals>
                        <goal>p2-metadata</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

    </plugins>
</build>

最后,在项目的父POM中添加:

<plugin>
    <groupId>org.eclipse.tycho</groupId>
    <artifactId>tycho-p2-plugin</artifactId>
    <version>${tycho-version}</version>
    <executions>
        <execution>
            <id>attached-p2-metadata</id>
            <phase>package</phase>
            <goals>
                <goal>p2-metadata</goal>
            </goals>
        </execution>
    </executions>
</plugin>

产品编辑器本身包含一个错误标记,但是可以忽略。 Tycho自行构建产品,并在运行的Eclipse IDE中自动设置源附件。

相关问题