Search code examples
eclipsemaventycho

How do I unpack the product for the build machine's environment at the end of a Tycho build?


I have a Tycho build that creates products for different enviroments. I would like to unpack the zip of the product that matches the enviroment of the machine the build is running on at the end of the maven build. Is that possible?


Solution

  • AFAIK, there is no easy way to ask Maven or Tycho about the environment of the build machine.

    However you could omit the environments configuration for Tycho, and in that way have Tycho only build for the currently running platform. Then, there will be exactly one unpacked product at target/products/<product.id>/*/*/*/. (The stars each match exactly one directory.)


    If your module building the platform-specific product inherits from a parent POM with explicit environments configuration, you can set an empty environments list (meaning "use the running platform") with the following configuration:

    <plugin>
       <groupId>org.eclipse.tycho</groupId>
       <artifactId>target-platform-configuration</artifactId>
       <version>${tycho-version}</version>
    
       <configuration>
          <environments combine.self="override" />
       </configuration>
    </plugin>