maven获取不到jar包

Posted by shellj on
今天遇到一个 maven 的问题,构建一个项目的时候忘记把一个依赖的 jar 包发布到仓库,然后构建失败,问题在于把依赖的 jar 包发布到仓库后还是构建失败,说无法获取到 jar 包,报的错误如下:
[ERROR] Failed to execute goal on project xxx-xxx: Could not resolve dependencies for project com.example:xxx-xxx:jar:1.10.2-RELEASE: Failure to find com.example:xxx-xxx:jar:2.1.0-RELEASE in http://repo.maven.example.com/repository/maven-public/ was cached in the local repository, resolution will not be reattempted until the update interval of nexus-releases has elapsed or updates are forced -> [Help 1]
当时没仔细看上面的错误信息,似乎是缓存了一个错误的 pom 信息,导致一直没有重新请求,删除掉本地仓库的依赖就好了。
mvn dependency:purge-local-repository