2

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.

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

I'm using tycho 1.3.0, with the tycho-pomless extension.

Root POM target declaration:

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

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

Lii
  • 11,553
  • 8
  • 64
  • 88
flavio.donze
  • 7,432
  • 9
  • 58
  • 91

1 Answers1

1

I'm sure this is not the maven way of building, the following workaround builds only one product.

To build I pass the scodi.customer variable:

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>
flavio.donze
  • 7,432
  • 9
  • 58
  • 91
  • Well, the pom fragment in your answer contains the modules list that appeared to be sufficient to resolve the target. Your answer doesn't have enough info, because the way "ch.scodi.client.target" was resolved is still behind the scenes. – Alexander Fedorov Apr 27 '19 at 18:41