为 RAP 和 RCP 风格的功能构建单个更新站点
Build single update-site for RAP and RCP flavored feature
我有一个针对单一来源 RCP/RAP Eclipse 功能项目的构建,该项目使用 Maven 配置文件来构建 RAP 或 RCP 包、片段和功能。
这相当有效。如果我将更新站点项目作为模块包含在上述构建的父 POM 中,我还可以使用 "eclipse-update-site"(或 "eclipse-repository")打包轻松构建特定于平台的更新站点。
不过,我想知道有没有办法
- 构建 RCP 目标平台 > 发布到本地 repo
- 构建 RAP 目标平台 > 发布到本地 repo
- 运行 为 RCP 构建(第 1 步中的目标平台)> 发布到本地仓库
- 运行 为 RAP 构建(第 2 步中的目标平台)> 发布到本地仓库
- 运行 仅为更新站点构建,包括 RAP 和 RCP 的功能(不编译任何东西,只是从 1+2 组装)
我可以成功执行步骤 1-4,但不能执行步骤 5,因为第谷试图用不同的限定符解析 category.xml 引用的特征。
如果我正确理解更新 sites/p2 存储库,应该可以提供各种风格的任何工件/捆绑包/功能,对吗?
我该如何解决这个问题,或者更确切地说:我能否拥有一个第谷构建,运行使用相同的限定符连续执行上述构建步骤?
附录:这个existing question同向并建议"install the (feature) Tycho project(s) into ... local Maven repository"。当我 运行 1. 和 2. 相继为两者指定相同的本地回购协议时,这实际上就是我正在做的事情。但是 3. 无法从那里提取引用的工件,因为限定符不同(两个不同的反应堆构建)。 运行 同一个 reactor 构建中的所有内容对我来说都很好,但我认为这是不可能的,因为涉及不同的目标平台。
我认为那里的解决方案非常接近我的需要,但我不明白我的 category.xml(或 site.xml)和 POM 中的额外依赖项如何协同工作。我是否必须完全放弃 category.xml 并在 eclipse-repository
POM 中重新指定我的所有依赖项?
我的构建大致如下所示:
foo.releng/pom.xml
(父 POM)
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>net.bar</groupId>
<artifactId>foo</artifactId>
<version>0.31.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<tycho-version>1.0.0</tycho-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jacoco-version>0.7.6.201602180812</jacoco-version>
</properties>
<modules>
<module>../foo.plugin1</module>
<module>../foo.plugin2</module>
<!-- feature module is built depending on target platform, see below -->
</modules>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho-version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<!-- target and dependency-resolution are RAP/RCP dependent, see profiles below -->
<resolver>p2</resolver>
<environments>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86</arch>
</environment>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86_64</arch>
</environment>
</environments>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>target-rcp</id>
<activation>
<property>
<name>target.platform</name>
<value>rcp</value>
</property>
</activation>
<modules>
<module>../foo.fragment.rcp</module>
<module>../foo.feature.rcp</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<target>
<artifact>
<groupId>net.bar</groupId>
<artifactId>net.bar.foo.target.rcp</artifactId>
<version>${project.version}</version>
<classifier>rcp</classifier>
</artifact>
</target>
<dependency-resolution>
<optionalDependencies>ignore</optionalDependencies>
<extraRequirements>
<requirement>
<type>eclipse-plugin</type>
<id>org.eclipse.ui</id>
<versionRange>0.0.0</versionRange>
</requirement>
... more rcp-only dependencies
</extraRequirements>
</dependency-resolution>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>target-rap</id>
<activation>
<property>
<name>target.platform</name>
<value>rap</value>
</property>
</activation>
<modules>
<module>../foo.fragment.rap</module>
<module>../foo.feature.rap</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
... same as for RCP above, but for RAP
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
这是 updatesite/category.xml
<?xml version="1.0" encoding="UTF-8"?>
<site>
<feature url="features/net.bar.foo.feature.rcp_0.31.0.qualifier.jar" id="net.bar.foo.feature.rcp" version="0.31.0.qualifier">
<category name="net.bar.rcp"/>
</feature>
<feature url="features/net.bar.foo.feature.rap_0.31.0.qualifier.jar" id="net.bar.foo.feature.rap" version="0.31.0.qualifier">
<category name="net.bar.rap"/>
</feature>
<category-def name="net.bar.rcp" label="RCP">
<description>
RCP Platform Features
</description>
</category-def>
<category-def name="net.bar.rap" label="RAP">
<description>
RAP Platform Features
</description>
</category-def>
</site>
和 updatesite/pom.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<version>0.31.0-SNAPSHOT</version>
<relativePath>../foo.releng/pom.xml</relativePath>
<artifactId>foo</artifactId>
<groupId>net.bar</groupId>
</parent>
<artifactId>net.bar.foo.updatesite</artifactId>
<packaging>eclipse-repository</packaging>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-packaging-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<archiveSite>true</archiveSite>
</configuration>
</plugin>
</plugins>
</build>
</project>
This question 一个非常相似的问题帮助我找到了解决方案。
我通过使用 reproducible timestamp qualifier 配置 tycho-packaging-plugin
成功了。
通过对我的所有连续构建使用常量版本限定符(基于 git 提交 ID),最终存储库构建可以在本地 maven 存储库中正确解析所有引用的功能包。
此调整后,以下构建运行没有任何问题,并发布了 RAP 和 RCP 功能风格:
# build rcp target
cd foo/net.bar.foo.target.rcp
mvn clean install -Dmaven.repo.local=../../m2
# build rap target
cd ../net.bar.foo.target.rap
mvn clean install -Dmaven.repo.local=../../m2
# build features and plugins for rcp, then for rap
cd ../net.bar.foo.releng
mvn clean install -Dmaven.repo.local=../../m2 -Dtarget.platform=rcp
mvn clean install -Dmaven.repo.local=../../m2 -Dtarget.platform=rap
# build p2 repository
cd ../net.bar.foo.updatesite
mvn clean install -Dmaven.repo.local=../../m2 -Dtarget.platform=rap
瞧:
我有一个针对单一来源 RCP/RAP Eclipse 功能项目的构建,该项目使用 Maven 配置文件来构建 RAP 或 RCP 包、片段和功能。
这相当有效。如果我将更新站点项目作为模块包含在上述构建的父 POM 中,我还可以使用 "eclipse-update-site"(或 "eclipse-repository")打包轻松构建特定于平台的更新站点。
不过,我想知道有没有办法
- 构建 RCP 目标平台 > 发布到本地 repo
- 构建 RAP 目标平台 > 发布到本地 repo
- 运行 为 RCP 构建(第 1 步中的目标平台)> 发布到本地仓库
- 运行 为 RAP 构建(第 2 步中的目标平台)> 发布到本地仓库
- 运行 仅为更新站点构建,包括 RAP 和 RCP 的功能(不编译任何东西,只是从 1+2 组装)
我可以成功执行步骤 1-4,但不能执行步骤 5,因为第谷试图用不同的限定符解析 category.xml 引用的特征。
如果我正确理解更新 sites/p2 存储库,应该可以提供各种风格的任何工件/捆绑包/功能,对吗?
我该如何解决这个问题,或者更确切地说:我能否拥有一个第谷构建,运行使用相同的限定符连续执行上述构建步骤?
附录:这个existing question同向并建议"install the (feature) Tycho project(s) into ... local Maven repository"。当我 运行 1. 和 2. 相继为两者指定相同的本地回购协议时,这实际上就是我正在做的事情。但是 3. 无法从那里提取引用的工件,因为限定符不同(两个不同的反应堆构建)。 运行 同一个 reactor 构建中的所有内容对我来说都很好,但我认为这是不可能的,因为涉及不同的目标平台。
我认为那里的解决方案非常接近我的需要,但我不明白我的 category.xml(或 site.xml)和 POM 中的额外依赖项如何协同工作。我是否必须完全放弃 category.xml 并在 eclipse-repository
POM 中重新指定我的所有依赖项?
我的构建大致如下所示:
foo.releng/pom.xml
(父 POM)
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>net.bar</groupId>
<artifactId>foo</artifactId>
<version>0.31.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<tycho-version>1.0.0</tycho-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jacoco-version>0.7.6.201602180812</jacoco-version>
</properties>
<modules>
<module>../foo.plugin1</module>
<module>../foo.plugin2</module>
<!-- feature module is built depending on target platform, see below -->
</modules>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho-version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<!-- target and dependency-resolution are RAP/RCP dependent, see profiles below -->
<resolver>p2</resolver>
<environments>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86</arch>
</environment>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86_64</arch>
</environment>
</environments>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>target-rcp</id>
<activation>
<property>
<name>target.platform</name>
<value>rcp</value>
</property>
</activation>
<modules>
<module>../foo.fragment.rcp</module>
<module>../foo.feature.rcp</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<target>
<artifact>
<groupId>net.bar</groupId>
<artifactId>net.bar.foo.target.rcp</artifactId>
<version>${project.version}</version>
<classifier>rcp</classifier>
</artifact>
</target>
<dependency-resolution>
<optionalDependencies>ignore</optionalDependencies>
<extraRequirements>
<requirement>
<type>eclipse-plugin</type>
<id>org.eclipse.ui</id>
<versionRange>0.0.0</versionRange>
</requirement>
... more rcp-only dependencies
</extraRequirements>
</dependency-resolution>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>target-rap</id>
<activation>
<property>
<name>target.platform</name>
<value>rap</value>
</property>
</activation>
<modules>
<module>../foo.fragment.rap</module>
<module>../foo.feature.rap</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
... same as for RCP above, but for RAP
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
这是 updatesite/category.xml
<?xml version="1.0" encoding="UTF-8"?>
<site>
<feature url="features/net.bar.foo.feature.rcp_0.31.0.qualifier.jar" id="net.bar.foo.feature.rcp" version="0.31.0.qualifier">
<category name="net.bar.rcp"/>
</feature>
<feature url="features/net.bar.foo.feature.rap_0.31.0.qualifier.jar" id="net.bar.foo.feature.rap" version="0.31.0.qualifier">
<category name="net.bar.rap"/>
</feature>
<category-def name="net.bar.rcp" label="RCP">
<description>
RCP Platform Features
</description>
</category-def>
<category-def name="net.bar.rap" label="RAP">
<description>
RAP Platform Features
</description>
</category-def>
</site>
和 updatesite/pom.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<version>0.31.0-SNAPSHOT</version>
<relativePath>../foo.releng/pom.xml</relativePath>
<artifactId>foo</artifactId>
<groupId>net.bar</groupId>
</parent>
<artifactId>net.bar.foo.updatesite</artifactId>
<packaging>eclipse-repository</packaging>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-packaging-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<archiveSite>true</archiveSite>
</configuration>
</plugin>
</plugins>
</build>
</project>
This question 一个非常相似的问题帮助我找到了解决方案。
我通过使用 reproducible timestamp qualifier 配置 tycho-packaging-plugin
成功了。
通过对我的所有连续构建使用常量版本限定符(基于 git 提交 ID),最终存储库构建可以在本地 maven 存储库中正确解析所有引用的功能包。
此调整后,以下构建运行没有任何问题,并发布了 RAP 和 RCP 功能风格:
# build rcp target
cd foo/net.bar.foo.target.rcp
mvn clean install -Dmaven.repo.local=../../m2
# build rap target
cd ../net.bar.foo.target.rap
mvn clean install -Dmaven.repo.local=../../m2
# build features and plugins for rcp, then for rap
cd ../net.bar.foo.releng
mvn clean install -Dmaven.repo.local=../../m2 -Dtarget.platform=rcp
mvn clean install -Dmaven.repo.local=../../m2 -Dtarget.platform=rap
# build p2 repository
cd ../net.bar.foo.updatesite
mvn clean install -Dmaven.repo.local=../../m2 -Dtarget.platform=rap
瞧: