我有一个单一来源的 RCP/RAP Eclipse 特性项目的构建,它使用 maven 配置文件来构建 RAP 或 RCP 包、片段和特性。
这工作得相当好。如果我将我的更新站点项目作为模块包含在上述构建的父 POM 中,我还可以使用“eclipse-update-site”(或“eclipse-repository”)打包轻松构建特定于平台的更新站点。
但是,我想知道,如果有办法
- 构建 RCP 目标平台 > 发布到本地仓库
- 构建 RAP 目标平台 > 发布到本地仓库
- 为 RCP 运行构建(步骤 1 中的目标平台)> 发布到本地存储库
- 为 RAP 运行构建(步骤 2 中的目标平台)> 发布到本地存储库
- 仅为更新站点运行构建,包括 RAP 和 RCP 的功能(不编译任何东西,只是从 1+2 组装)
我可以成功执行步骤 1-4,但不能成功执行步骤 5,因为 Tycho 试图用不同的限定符解析 category.xml 引用的功能。
如果我正确理解更新站点/p2 存储库,应该可以提供各种风格的任何工件/捆绑包/功能,对吧?
我该如何解决这个问题,或者更确切地说:我可以有一个单一的 tycho 构建,它使用相同的限定符连续运行上述构建步骤吗?
附录:这个现有问题朝着相同的方向发展,并建议“将(功能)Tycho 项目安装到......本地 Maven 存储库中”。这实际上就是我在运行 1. 和 2. 时正在做的事情,为两者指定相同的本地存储库。但是 3. 无法从那里提取引用的工件,因为限定符不同(两个不同的反应器构建)。在同一个反应堆构建中运行所有东西对我来说完全没问题,但我认为这是不可能的,因为涉及不同的目标平台。
我认为那里的解决方案非常接近我的需要,但我不明白我的 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>