5

tycho-p2-director-plugin 似乎没有办法在最终的 ZIP 文件名中添加版本号。它产生

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

虽然我想拥有

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

最好的方法是什么?以某种方式用 maven-antrun-plugin 重命名?使用 Maven 资源插件重命名?还有什么?

4

3 回答 3

9

https://bugs.eclipse.org/bugs/show_bug.cgi?id=357503的错误报告看来,他们已经添加了直接从 Tycho 0.14.0 更改 zip 文件的文件名的功能。我将以下内容用于我的 tycho-p2-director-plugin 块。

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

关键位在<configuration>末尾部分,您可以在其中使用<archiveFileName>标签指定 zip 文件的前缀。-<os>.<ws>.<arch>.<archiveExtension>正如人们所希望的那样,该文件的后缀仍然是 。

于 2013-02-26T12:20:49.773 回答
1

以下是我在项目中所做的,

        <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>
于 2011-12-21T02:26:17.857 回答
-1

答案不是第谷特有的:

<build>
    <finalName>myproduct</finalName>
</build>
于 2012-04-14T20:19:56.883 回答