Add the Maven Antrun Plugin to the pom.xml
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>deploy</id>
<phase>package</phase>
<configuration>
<tasks>
<copy todir="${project.basedir}">
<fileset dir="target">
<include name="${build.finalName}.${project.packaging}" />
</fileset>
</copy>
<move file="${project.basedir}/${build.finalName}.${project.packaging}" tofile="${project.basedir}/name-you-want.jar"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
After executing, the package will be copied to the base directory from target directory and then rename it to what you want.
本文介绍如何在pom.xml中配置Maven Antrun插件以实现打包阶段复制并重命名最终制品。通过配置<plugin>元素,可以在构建过程中将目标文件从target目录复制到项目根目录,并按指定名称保存。
3598

被折叠的 条评论
为什么被折叠?



