rename ZIP files created by tycho-p2-director-plugin
Asked Answered
A

3

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?

Aleuromancy answered 21/12, 2011 at 0:51 Comment(0)
D
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>
Dickie answered 21/12, 2011 at 2:26 Comment(2)
this is a known pending enhancement request: bugs.eclipse.org/bugs/show_bug.cgi?id=357503Dennison
Thanks a lot, guys! This helped. I bound this step to "package" step and it works fine now.Aleuromancy
B
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.

Beesley answered 26/2, 2013 at 12:20 Comment(0)
D
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>
Dickie answered 21/12, 2011 at 2:26 Comment(2)
this is a known pending enhancement request: bugs.eclipse.org/bugs/show_bug.cgi?id=357503Dennison
Thanks a lot, guys! This helped. I bound this step to "package" step and it works fine now.Aleuromancy
A
-1

The answer is not Tycho specific:

<build>
    <finalName>myproduct</finalName>
</build>
Aniakudo answered 14/4, 2012 at 20:19 Comment(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.Kailakaile

© 2022 - 2024 — McMap. All rights reserved.