'rename maven jar-with-dependencies
My plugin section in the pom file looks like this:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.gateway.gatewayService</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
After the build finishes, I'm left with the following files:
gateway-1.1.0.pom
gateway-1.1.0.jar
gateway-1.1.0.jar-with-dependencies.jar
I would like to get the following outcome instead:
gateway-1.1.0.pom
gateway-1.1.0.jar
gateway-1.1.0-all.jar
Which means changing gateway-1.1.0.jar-with-dependencies.jar
to gateway-1.1.0-all.jar
, is that possible?
Solution 1:[1]
Remove the content
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
Of line 5,6&7 and then try.
Solution 2:[2]
You need to add two tags which are <finalName>
and <appendAssemblyId>
inside <configuration>
Set <appendAssemblyId>
to false
You need to change your maven-assembly-plugin
as below
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<configuration>
<finalName>all</finalName> // name of your jar
<appendAssemblyId>false</appendAssemblyId> // append will be false
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.gateway.gatewayService</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Sandeep Vokkareni |
Solution 2 | RenceAbi |