I am trying to create a jar file which has all the necessary classes extracted within the jar. But for few dependent jar like log4j, it creates some folders inside META-INF/maven/*
. I have a limitation that the server in which I will be placing the generated jar file will not have Internet connectivity. So if there is any content in this META-INF/maven/*
folder then it gives me an error.
My maven descriptor looks like the following
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<minimizeJar>true</minimizeJar>
<finalName>myclient</finalName>
</configuration>
</plugin>
</plugins>
</build>
I am able to extract the required class files in the generated jar but the maven folder is still getting generated under META-INF
. I have to manually delete the folder to make everything work. Please advice on how to automate this removal of maven folder from the generated jar file.