Removing Default Jar created by Maven Build


Here you will see an example on how to remove default jar by maven build tool. Generally this may be required in a situation where you are generating executable jar or executable jars and your application does not require additional non-executable jar generated by maven build. Then you can remove such jar from the target folder.


Apache Maven 3.6.3, Java at least 1.8

Remove Default JAR

You have seen in previous examples on how to generate single executable jar file or multiple executable jar files.

But if you had noticed carefully you saw there was an additional jar which was created in the target folder and this jar was created by maven build tool. By default maven uses maven-jar-plugin to generate jar file.

To prevent maven tool from generating such default jar you need to override the maven-jar-plugin.

You need to add this additional plugin in the plugin section along with maven-assembly-plugin.

The example may be given in the below pom.xml file:

<project xmlns="" xmlns:xsi=""
    <name>executable jar</name>

Thanks for reading.

Leave a Reply

Your email address will not be published. Required fields are marked *