Question

I have imported a existent maven project (swagger for jersey jax-rs) into eclipse.

I get a bunch of errors: It always has to do with the jackson-databind.jar

Example error: Archive for required library: '.../.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.1.5/jackson-databind-2.1.5.jar' in project 'swagger-core_2.9.1' cannot be read or is not a valid ZIP file

I cannot find the .m2 folder? I am new to the maven stuff, do i have to install something extra before i import a maven project into eclipse?

Thx

Was it helpful?

Solution

I cannot find the .m2 folder?

By default the .m2 directory is located at the home directory.

  1. For *Unix operating systems, it will be something like /home/<user_who_fires_maven_commands>/.m2/...
  2. For Windows machines , the m2 will be located at C:\Users\<user>\.m2\...

As for the exception you are getting

Archive for required library: '.../.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.1.5/jackson-databind-2.1.5.jar' in project 'swagger-core_2.9.1' cannot be read or is not a valid ZIP file

It is most probable that the archive file has gotten curropted ( maybe a download issue or might be possible that its sha1 doesn't match with the one that is on the central repo ). So you can try by simply deleting this jar file and then run mvn install and it will re-attempt to download the file again.

Another thing I would like to point out is that since this is a new eclipse installation, I would suggest that you re-index your local m2 folder so that this new eclipse knows about the files and folders inside the original m2 folder. To re-index, goto Window -> preferences --> Maven --> User settings --> there will be a text field stating the path of the .m2 ( make sure its correct ) and then press re-index

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top