Deploying Maven project throws java util zip ZipException invalid LOC header bad signature

0 votes

I am getting the below exception when I run my mvn install. I have even deleted the local repository and ran again getting the same exception.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:2.1:shade (default) on project cores-batch: Error creating shaded jar: invalid LOC header (bad signature) -> [Help 1]

<?xml version="1.0" encoding="UTF-8"?> 
<plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-shade-plugin</artifactId> 
      <version>2.1</version> 
      <configuration> 
              <skipTests>true</skipTests> 
</configuration> 
<executions> 
    <execution> 
          <phase>package</phase> 
            <goals>
                      <goal>shade</goal> 
            </goals> 
            <configuration> 
                <artifactSet> 
                    <excludes> 
                        <exclude>commons-logging:commons-logging:jar:*
                  </exclude> </excludes> 
              </artifactSet> 
          <filters> 
              <filter> 
                    <artifact>*:*</artifact> 
                    <excludes> 
                          <!-- workaround for a spring issues --> 
                          <exclude>META-INF/*.SF                     
                          <exclude>META-INF/*.DSA</exclude>    
                          <exclude>META-INF/*.RSA</exclude>       
                          <exclude>log4j.xml</exclude> 
                </excludes>
            </filter> 
        </filters> 
<!-- May be needed to work around another issue in Spring --> 
<transformers> 
<transformerimplementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> 
    <resource>META-INF/spring.handlers</resource> 
</transformer> <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> <resource>META-INF/spring.schemas</resource> </transformer> </transformers> 

  </configuration> 

  </execution> 

</executions> 

</plugin>

ERROR:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:2.1:shade (default) on project cores-batch: Error creating shaded jar: invalid LOC header (bad signature) -> [Help 1] 

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:2.1:shade (default) on project cores-batch: Error creating shaded jar: invalid LOC header (bad signature) 
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217) 
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) 
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) 
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) 
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) 
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) 
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) 
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) 
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) 
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:606) 
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) 
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) 
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) 
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) 
Caused by: org.apache.maven.plugin.MojoExecutionException: Error creating shaded jar: invalid LOC header (bad signature) 
at org.apache.maven.plugins.shade.mojo.ShadeMojo.execute(ShadeMojo.java:528) 
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) 
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) ... 19 more Caused by: java.util.zip.ZipException: invalid LOC header (bad signature) 
at java.util.zip.ZipFile.read(Native Method) at java.util.zip.ZipFile.access$1400(ZipFile.java:56) 
at java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:679) 
at java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(ZipFile.java:415) 
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158) 
at java.io.FilterInputStream.read(FilterInputStream.java:107) 
at org.codehaus.plexus.util.IOUtil.copy(IOUtil.java:189) 
at org.codehaus.plexus.util.IOUtil.copy(IOUtil.java:175) 
at org.apache.maven.plugins.shade.DefaultShader.addResource(DefaultShader.java:427) 
at org.apache.maven.plugins.shade.DefaultShader.shade(DefaultShader.java:186) 
at org.apache.maven.plugins.shade.mojo.ShadeMojo.execute(ShadeMojo.java:458) ... 21 more [ERROR] [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Feb 17, 2022 in Others by Soham
• 9,700 points
2,994 views

1 answer to this question.

0 votes

This particular jar file of yours may be corrupt so start by removing the content of the following folder:

C:\Users\[username]\.m2\repository

Then right click your project, select Maven, Update Project, check on Force Update of Snapshots. 

answered Feb 17, 2022 by Aditya
• 7,680 points

Related Questions In Others

0 votes
0 answers

NullPointerException: Attempt to invoke virtual method 'int java.util.ArrayList.size()' on a null object reference

The  Fragment where I have my List View: public class RecordingListFragment ...READ MORE

May 8, 2022 in Others by Kichu
• 19,050 points
3,358 views
0 votes
1 answer

Using unserialize in PHP throws the same error repeatedly

I googled 'Node no longer exists', and ...READ MORE

answered Nov 14, 2018 in Others by DataKing99
• 8,240 points
1,253 views
0 votes
0 answers

Can we write AES enryption in Javascript and Decryption in Java using a static SALT and IV

I'm working on AES encryption I want to ...READ MORE

Jun 4, 2019 in Others by Eighteen
• 120 points
1,708 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,500 views
+2 votes
1 answer
0 votes
1 answer

error: ORA-65096: invalid common user or role name in oracle

To start with, the oerr utility is ...READ MORE

answered Feb 16, 2022 in Others by Aditya
• 7,680 points
16,817 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP