Pages

Friday, October 26, 2012

[ERROR] error: error reading *.jar; invalid LOC header (bad signature) - Maven build error

Some time you will get the following error when building a project with maven. Most of the time, this happens after checking out new maven project and try to build the project with an existing repository. Some existing jar files can not be read when building the new project. This may happen because, you may already have some projects sharing the same repository.

The following shows a sample error.

[ERROR] error: error reading /home/vinesh/.m2/repository/org/codehaus/woodstox/stax2-api/3.1.1/stax2-api-3.1.1.jar; invalid LOC header (bad signature)

As a solution for this, you can remove the existing jar file and build the project again in online mode. You can use the following command.

mvn clean install -Dmaven.test.skip=true

Now, carefully look into the console.You can see, it downloads the removed jar file from the maven repository.
You may also like:

2 comments:

  1. It Throw Because your .jar is Invalid Or Corrupted.

    Follow the Steps:

    Note : .m2 Folder is Hidden by Default. UnHide the Folder.

    Step 1:Delete all the Content in .m2/repository Folder.

    Step 2:Restart Your Eclipse.

    Step 3:Maven->Update Project .Checked- Force Update of Snapshots/Releases.

    Step 4:Run as Maven Clean.

    Step 5:Run as Maven Install.

    Step 6: Clean Project.

    Step 7 : Run Your Project.

    I Hope you Find your Solution Here..

    Thanks..

    ReplyDelete

Share

Widgets