Maven的重命名一切完成后的文件 [英] Maven rename a file after everything else finishes
问题描述
我有一个项目,我需要重新命名由的Maven Assembly插件
之后一切结束(在编译/建筑/装配工艺)所生成的最终输出文件。
的的Maven Assembly插件
正在产生最终 .zip文件
文件的基础上,项目的名称,我需要完全以重命名此最终version.oxt
。我试图使用 Maven的antrun-插件
将其重命名,用在这里等类似的问题为指向,但没有运气(我从来没有使用Maven的蚂蚁或之前,所以也许我失去了一些东西)。
这是<建立>
部分项目的的pom.xml
。重命名部分似乎被完全忽略,因为在我的家里不产生文件
文件夹中。
<建立>
<&插件GT; <&插件GT;
<&的groupId GT; org.apache.maven.plugins< /的groupId>
<&的artifactId GT; Maven的组装插件< / artifactId的>
<&版GT; 2.4< /版本>
<&执行GT;
<执行与GT;
<&ID GT;装配< / ID>
<阶段>包装及LT; /阶段>
<目标>
<&目标GT;连接< /目标>
< /目标>
<结构>
<归档和GT;
< manifestFile>的src / main /资源/ META-INF / MANIFEST.MF< / manifestFile>
< /存档>
<&描述GT;
<描述符GT;的src / main /组装/噢噢-jar.xml中的< /描述符GT;
<描述符GT;的src / main /组装/ ooo.xml< /描述符GT;
< /&描述GT;
< /结构>
< /执行>
< /处决>
< /插件> <&插件GT;
<&的groupId GT; org.apache.maven.plugins< /的groupId>
<&的artifactId GT;的maven-antrun-插件< / artifactId的>
<&执行GT;
<执行与GT;
&所述;阶段>部署&下; /阶段> <结构>
<任务和GT;
<复制文件=$ {} project.build.directory /target/libreofficeplugin-ooo.zip
TOFILE =/家/ brunofinger /最终version.oxt/>
< /任务>
< /结构>
< /执行>
< /处决>
< /插件> < /插件>
< /构建>
一些修改,使工作,可能是相
是错误的,但使用<阶段>安装与LT; /阶段>
似乎使其工作:
<&插件GT;
<&的groupId GT; org.apache.maven.plugins< /的groupId>
<&的artifactId GT;的maven-antrun-插件< / artifactId的>
<&版GT; 1.7 LT; /版本>
<&执行GT;
<执行与GT;
<阶段>安装与LT; /阶段> <结构>
<目标>
<复制文件=$ {} project.build.directory /libreofficeplugin-ooo.zipTOFILE =$ {} project.build.directory /final-version.oxt/>
< /目标与GT;
< /结构>
<目标>
<&目标GT;运行< /目标>
< /目标>
< /执行>
< /处决>
< /插件>
I have a project which I need to rename the final output file generated by the Maven Assembly Plugin
after everything else finishes (in the compiling/building/assembly process).
The Maven Assembly Plugin
is generating a final .zip
file, based on the project's name, and I need to rename this completely to final-version.oxt
. I'm trying to use the maven-antrun-plugin
to rename it, as pointed by other similar questions here, but no luck (I've never used Maven or Ant before, so maybe I'm missing something).
This is the <build>
section of the project's pom.xml
. The rename part seems to be completely ignored, since no file is generated in my home
folder.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>assembly</id>
<phase>package</phase>
<goals>
<goal>attached</goal>
</goals>
<configuration>
<archive>
<manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
</archive>
<descriptors>
<descriptor>src/main/assembly/ooo-jar.xml</descriptor>
<descriptor>src/main/assembly/ooo.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>deploy</phase>
<configuration>
<tasks>
<copy file="${project.build.directory}/target/libreofficeplugin-ooo.zip"
tofile="/home/brunofinger/final-version.oxt" />
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
A few modifications made it work, probably the phase
was wrong, but using <phase>install</phase>
seems to make it work:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>install</phase>
<configuration>
<target>
<copy file="${project.build.directory}/libreofficeplugin-ooo.zip" tofile="${project.build.directory}/final-version.oxt" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
这篇关于Maven的重命名一切完成后的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!