How to force maven update?

后端 未结 25 2585
失恋的感觉
失恋的感觉 2020-11-22 03:18

I imported my already working project on another computer and it started to download dependencies.

Apparently my internet connection crashed and now I get the foll

25条回答
  •  我寻月下人不归
    2020-11-22 04:03

    Previous versions of maven did not force the check for missing releases when used -U with mvn clean install, only the snapshots, though newer version supports this.

    For someone still struggling with previous version, following can be helpful-

    On Windows:

    cd %userprofile%\.m2\repository
    for /r %i in (*.lastUpdated) do del %i
    

    On Linux:

    find ~/.m2  -name "*.lastUpdated" -exec grep -q "Could not transfer" {} \; -print -exec rm {} \;
    

    Whenever maven can't download dependencies for any reason (connectivity/not exists etc), it will add the ".error=Could not transfer artifact" in dependency-name.lastUpdate file in respective folder under $home/.m2 directory. Removing these files will force maven to try fetching the dependencies again.

提交回复
热议问题