[JAVA] Maven repository local cache

I was addicted to Maven's local cache under Eclipce environment, so I would like to keep it as a memorandum.

The beginning of the matter

At the timing when the source was updated by a certain project, git pull

The project cannot be built until the build path error is resolved. ----------------------. jar not found.

An error like this caused the Junit test in the project to stop working. The timing just happened to be right after git pull, and I don't know exactly what the trigger was.

trial and error

Check Maven dependencies for now. The jar file displayed in the error exists. But when I try to view the jar file from Package Explorer, it doesn't open.

invalid LOC header(bad signature)

The above display is displayed on the screen. ~~ ** I don't know. ** ~~ When I tried to get the jar by specifying another version in pom.xml, the compilation went well. The Junit test started working, but it didn't solve anything, so I continued the trial. When I think about it later, the behavior around here may have been a hint for the solution.

Regain your mind, and if you don't understand the error, try it for the time being ...

--Project Refresh --Clean → Build by removing the error from the View Issues tab

I tried it all, but it didn't work. 

Solution

When asking Google teacher, The local cache of the Maven repository may be wrong.

It seems that there is a Maven cache under ** .m2 **. Delete all the folders under ~ / .m2 / repository and ** Right-click Maven project → Maven → Update Maven Project ... ** and re-reflect pom.xml.

Oh, it's compiled. I was able to execute the Junit test safely, and one case was settled.

Summary

For the time being, this is because I always take measures to resolve the error. Let's deal with it after grasping the cause firmly while leaving the lack of knowledge. Obviously, it was a good commandment.

However, when you say "I don't know, but an error is occurring" like this time, You must have a ** weapon that you can try out ** ...

Recommended Posts

Maven repository local cache
Creating a local repository
maven
Browse local Maven artifacts in Gradle
Procedure to publish to Maven Central Repository
How to add local jar to maven pom.xml
Build Maven repository on AWS S3 service
How to create a Maven repository for 2020
Build a Maven repository on AWS S3