Already referred following SO question: Deploying Maven project throws java.util.zip.ZipException: invalid LOC header (bad signature)
but my question is I face this error:
Error creating shaded jar: invalid LOC header (bad signature)
whenever a new artifact is added to pom.xml.
If I delete the .m2
folder and rerun clean build, then everything works fine. My question is : is deleting the .m2
folder the only solution? Isn't there a cleaner solution available?
Is this an issue with the shaded plugin (because irrespective of the which new artifact is getting added, the shade plugin fails with this error and resolves after deleting .m2). I also have multiple repos define, could it be an issue?
Repo configuration: (local repo is to install local jars to maven)
<repositories>
<repository>
<id>local-maven-repo</id>
<url>file:///${local.repo.path}</url>
<releases>
<updatePolicy>always</updatePolicy>
</releases>
</repository>
<repository>
<id>central</id>
<url>http://repo.maven.apache.org/maven2/</url>
</repository>
<repository>
<id>ga-all-repository</id>
<url>https://maven.repository.redhat.com/ga/</url>
</repository>
</repositories>
Maven shade configuration
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<execution>
<id>add-thirdParty</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<outputFile>${project.basedir}/target/tp.jar</outputFile>
<source>1.7</source>
<target>1.7</target>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</plugin>