我正在 maven 生命周期的打包阶段使用 maven-assembly-plugin 的 jar-with-dependencies 组件创建一个可执行 jar。但是,我看不到配置输出 jar 名称的方法。它似乎总是像
appname-1.1-r1011-jar-with-dependencies.jar
我怎样才能将它配置为其他东西,比如
appname-1.1-r1011.jar
这可能吗?
最佳答案
您可以设置 appendAssemblyId
false
的参数在 maven-assembly-plugin
避免使用“jar-with-dependencies”后缀。
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-5</version>
<executions>
<execution>
<id>jar-with-dependencies</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
</executions>
</plugin>
关于maven-2 - 您如何选择带有依赖项的 Maven jar 的文件名?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2320417/