简体   繁体   English

如果使用 Tycho 从子项目构建,则找不到目标平台

[英]Target platform not found if building from child project with Tycho

In my project there are multiple eclipse product files (100+ for different customers), I would like to build only one specific product at the time.在我的项目中有多个 eclipse 产品文件(不同客户有 100 多个),我当时只想构建一个特定的产品。

If I build the whole project from the root folder, the project is build correctly with all products.如果我从根文件夹构建整个项目,则该项目将与所有产品一起正确构建。

cd scodi
mvn clean verify

I get an error if I try to build only one product:如果我尝试仅构建一种产品,则会收到错误消息:

cd scodi/rcp/releng/ch.scodi.client.product
mvn clean verify

[ERROR] Internal error: java.lang.RuntimeException: Could not resolve target platform specification artifact ch.scodi:ch.scodi.client.target:target:1.0.0-SNAPSHOT -> [Help 1] org.apache.maven.InternalErrorException: Internal error: java.lang.RuntimeException: Could not resolve target platform specification artifact ch.scodi:ch.scodi.client.target:target:1.0.0-SNAPSHOT [错误] 内部错误:java.lang.RuntimeException:无法解析目标平台规范工件 ch.scodi:ch.scodi.client.target:target:1.0.0-SNAPSHOT -> [Help 1] org.apache.maven。 InternalErrorException:内部错误:java.lang.RuntimeException:无法解析目标平台规范工件 ch.scodi:ch.scodi.client.target:target:1.0.0-SNAPSHOT

I'm using tycho 1.3.0, with the tycho-pomless extension.我正在使用 tycho 1.3.0,带有tycho-pomless扩展。

Root POM target declaration:根 POM 目标声明:

<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>
            <artifact>
                <groupId>ch.scodi</groupId>
                <artifactId>ch.scodi.client.target</artifactId>
                <version>1.0.0-SNAPSHOT</version>
            </artifact>
        </target>
        <environments>
            <environment>
                <os>win32</os>
                <ws>win32</ws>
                <arch>x86_64</arch>
            </environment>
        </environments>
    </configuration>
</plugin>

The product pom:产品pom:

<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>
    <artifactId>ch.scodi.client.product</artifactId>
    <packaging>eclipse-repository</packaging>
    <parent>
        <groupId>ch.scodi</groupId>
        <artifactId>ch.scodi.rcp.releng</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <relativePath>../</relativePath>
    </parent>

    <build>
        <plugins>
            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-p2-repository-plugin</artifactId>
                <version>${tycho.version}</version>
                <configuration>
                    <includeAllDependencies>true</includeAllDependencies>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-p2-director-plugin</artifactId>
                <version>${tycho.version}</version>
                <executions>
                    <execution>
                        <id>materialize-products</id>
                        <goals>
                            <goal>materialize-products</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>archive-products</id>
                        <goals>
                            <goal>archive-products</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

Is it not possible to build only certain products?不能只生产某些产品吗?

I'm sure this is not the maven way of building, the following workaround builds only one product.我确定这不是 maven 构建方式,以下解决方法仅构建一种产品。

To build I pass the scodi.customer variable:为了构建,我传递了scodi.customer变量:

mvn clean verify -Dscodi.customer=demo mvn clean verify -Dscodi.customer=demo

<modules>
    <module>${scodi.customer}/common/plugins</module>
    <module>${scodi.customer}/ui/plugins</module>
    <module>${scodi.customer}/rcp/features</module>
    <module>${scodi.customer}/rcp/releng</module>
</modules>
<build>
    <plugins>
        <plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>target-platform-configuration</artifactId>
            <version>${tycho.version}</version>
            <configuration>
                <target>
                    <artifact>
                        <groupId>ch.scodi</groupId>
                        <artifactId>ch.scodi.client.target</artifactId>
                        <version>1.0.0-SNAPSHOT</version>
                    </artifact>
                </target>
                <environments>
                    <environment>
                        <os>win32</os>
                        <ws>win32</ws>
                        <arch>x86_64</arch>
                    </environment>
                </environments>
            </configuration>
        </plugin>
    </plugins>
</build>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM