This is how I configured maven-assembly-plugin
这就是我配置maven-assembly-plugin的方法
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<finalName>myapp</finalName>
<archive>
<manifest>
<mainClass>com.myapp.Main</mainClass>
</manifest>
</archive>
<!--
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
-->
</configuration>
</plugin>
and I expect the final jar file should be myapp.jar
but it ends up with myapp-jar-with-dependencies.jar
我希望最终的jar文件应该是myapp.jar,但最终会得到myapp-jar-with-dependencies.jar
Can you tell me how to configure to exclude "jar-with-dependencies"
out of the final name?
你能告诉我如何配置从最终名称中排除“jar-with-dependencies”吗?
1 个解决方案
#1
116
You can specify the finalName
property to give the jar the name you want, and specify that appendAssemblyId
should be false to avoid the jar-with-dependencies
suffix. The configuration below will output a jar called test.jar
您可以指定finalName属性以为jar提供所需的名称,并指定appendAssemblyId应为false以避免jar-with-dependencies后缀。下面的配置将输出一个名为test.jar的jar
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<finalName>test</finalName>
<archive>
<manifest>
<mainClass>com.myapp.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</plugin>
#1
116
You can specify the finalName
property to give the jar the name you want, and specify that appendAssemblyId
should be false to avoid the jar-with-dependencies
suffix. The configuration below will output a jar called test.jar
您可以指定finalName属性以为jar提供所需的名称,并指定appendAssemblyId应为false以避免jar-with-dependencies后缀。下面的配置将输出一个名为test.jar的jar
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<finalName>test</finalName>
<archive>
<manifest>
<mainClass>com.myapp.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</plugin>