5

tycho-p2-director-plugin does not seem to have a way to add a version number to the final ZIP file names. it produces

myproduct-win32.win32.x86.zip
myproduct-macosx.cocoa.x86.zip
myproduct-linux.gtk.x86.zip

while I'd like to have

myproduct-1.6.0-win32.zip
myproduct-1.6.0-linux32.zip
myproduct-1.6.0-macos.zip

what's the best way? rename with maven-antrun-plugin somehow? rename with maven resources plugin? anything elese?

3 Answers 3

9

From the bug report at https://bugs.eclipse.org/bugs/show_bug.cgi?id=357503 it seems that they've added the ability to change the filename of the zip files directly from Tycho 0.14.0. I'm using the following for my tycho-p2-director-plugin block.

<plugins>
  <plugin>
    <groupId>org.eclipse.tycho</groupId>
    <artifactId>tycho-p2-director-plugin</artifactId>
    <version>0.16.0</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>
    <configuration>
      <products>
        <product>
          <id>MY_PRODUCT_ID</id>
          <archiveFileName>MyProduct-${project.version}</archiveFileName>
        </product>
      </products>
    </configuration>
  </plugin>

The key bit is in the <configuration> section at the end, where you can specify the prefix of the zip file using the <archiveFileName> tag. The suffix of the file is still -<os>.<ws>.<arch>.<archiveExtension>, as one might hope.

0
1

Below is what I do in my project,

        <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>
                    <configuration>
                        <installFeatures>false</installFeatures>
                        <profile>Installer</profile>
                    </configuration>
                </execution>
                <execution>
                    <id>archive-products</id>
                    <goals>
                        <goal>archive-products</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <!-- ANT actions -->
        <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.6</version>
            <executions>
                <!-- Rename the ZIP files -->
                <execution>
                    <id>update-zip-files</id>
                    <phase>install</phase>
                    <configuration>
                        <target>
                            <!-- Rename the products -->
                            <move verbose="true" todir="${project.build.directory}/products">
                                <mapper type="regexp" from="^(Installer-)(.*)$$"
                                    to="\1N-${maven.build.timestamp}-\2" />

                                <fileset dir="${project.build.directory}/products">
                                    <include name="*.zip" />
                                </fileset>
                            </move>
                        </target>
                    </configuration>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
2
-1

The answer is not Tycho specific:

<build>
    <finalName>myproduct</finalName>
</build>
1
  • This is wrong. Tycho provides a custom packaging type for "product" builds. Those artifacts are created by a Tycho plug-in which needs its own configuration.
    – Gunnar
    Jul 11, 2013 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.