I am trying to build a project using Maven but I don’t know Maven.
Anyway I had a problem and I found in a link to use an older version of Maven. So I did, since the instructions for the project were about 2.0.9 anyway.
But now I am not sure how to proceed. I see under my user.home directory a .m2 folder with a repository directory.
Should I delete this or not?
I am trying to build a project using Maven but I don’t know Maven.
Share
The
.m2folder contains the downloaded artifacts and some other repository info, which do not depend on the used maven version. So you dont need to delete anything, just use the maven binary of your choice.EDIT: the contents of the artifacts –
.jars,.poms,.bomsetc. are defined by the artifacts themselves which are the accesible through repositories/catalogues. The.pomof your project references the needed artifacts. The maven binary downloads the artifacts (and does many other things which are OT here) to your local cache – the.m2directory. The point is, no matter what version of the maven binary you use, the artifacts remain the same.You surely can delete your repository. As long as you have an internet connection maven will simply download the artifacts again. But there is nothing to be gained by the removal except a longer initial build time and some traffic.
Sometimes it does make sence to delete certain metadata from the repo, like the
.lastUpdatedfiles. It is only advisable if maven is unable to find a dependency which you know for sure is in your repository. You can then runfind ./ -name "*.lastUpdated" -exec rm {} \;.