如何选择maven jar-with-dependencies的文件名?

时间:2010-02-23 17:47:07

标签: maven-2 maven-plugin

我在maven生命周期的包阶段使用maven-assembly-plugin的jar-with-dependencies组件创建一个可执行jar。但是,我看不到配置输出jar的名称的方法。它似乎总是像

appname-1.1-r1011-jar-with-dependencies.jar 

我如何将其配置为其他内容,例如

appname-1.1-r1011.jar

这可能吗?

1 个答案:

答案 0 :(得分:23)

您可以在appendAssemblyId中将maven-assembly-plugin参数设置为false,以避免“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>