【问题标题】:Target platform not found if building from child project with Tycho如果使用 Tycho 从子项目构建,则找不到目标平台
【发布时间】:2019-01-04 10:28:43
【问题描述】:

在我的项目中,有多个 eclipse 产品文件(100 多个用于不同的客户),我想当时只构建一个特定的产品。

如果我从根文件夹构建整个项目,则该项目与所有产品都正确构建。

cd scodi
mvn clean verify

如果我尝试只构建一个产品,我会收到错误:

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

[错误] 内部错误:java.lang.RuntimeException:无法解析 目标平台规范工件 ch.scodi:ch.scodi.client.target:target:1.0.0-SNAPSHOT -> [帮助 1] org.apache.maven.InternalErrorException:内部错误: java.lang.RuntimeException:无法解析目标平台 规范工件 ch.scodi:ch.scodi.client.target:target:1.0.0-SNAPSHOT

我正在使用带有 tycho-pomless 扩展的 tycho 1.3.0。

根 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>

产品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>

难道不能只生产某些产品吗?

【问题讨论】:

    标签: java eclipse maven tycho eclipse-pde


    【解决方案1】:

    我确定这不是 maven 构建方式,以下解决方法仅构建一个产品。

    为了构建,我传递了scodi.customer 变量:

    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>
    

    【讨论】:

    • 嗯,您的答案中的 pom 片段包含似乎足以解决目标的模块列表。您的答案没有足够的信息,因为解决“ch.scodi.client.target”的方式仍在幕后。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-06
    • 2012-11-04
    • 1970-01-01
    • 2019-01-02
    相关资源
    最近更新 更多