In this post it is already explained how to use your MANIFEST and exclude some other MANIFEST files: https://stackoverflow.com/a/38257466/2700344
I just want to add why you may need your own manifest file
You are building new jar with executable class and this what your need MANIFEST.MF
for - to Define the entry point of the Application, make the Jar executable and add dependency classpath. This is why you may need your own manifest. You can use maven-jar-plugin for configuring main class like this and it will create manifest for you:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<mainClass>com.AkshayHasari.App</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
Also You can simply exclude MANIFEST files and some other files in the shade plugin configuration using filter
:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<!-- filters section excludes some stuff from the target JAR that
oughtn't be in there - such as JAR metadata, ant build files, text files,
etc. that are packaged with some dependencies, but which don't belong in
an uber JAR. -->
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*</exclude>
<exclude>NOTICE</exclude>
<exclude>/*.txt</exclude>
<exclude>build.properties</exclude>
</excludes>
</filter>
</filters>
<!-- <finalName>${project.artifactId}-${project.version}-shaded</finalName> -->
<outputDirectory>${basedir}/target</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>