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

时间:2019-01-04 10:28:44

标签: java eclipse maven tycho eclipse-pde

在我的项目中,有多个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>

不可能只制造某些产品吗?

1 个答案:

答案 0 :(得分:0)

我确定这不是构建的主要方法,以下解决方法仅构建一种产品。

要构建,我传递了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>