使用idea,maven无法下载jar包的坑

当你添加一个新的依赖,发现无法引用该包时,你可能会检查一下groupId/artifactId/version有没有写错,然后去https://mvnrepository.com看看有没有该版本号,或者看看镜像有没有配置,但是在这些步骤都检查过后发现都没问题,但是jar包还是无法下载,你可以尝试install一下该项目,如果发现有异常是:

[ERROR] Failed to execute goal on project [projectName]: Could not resolve dependencies for project xxxx:xxxx: Cannot access nutz (http://jfrog.nutz.cn/artifactory/libs-release) in offline mode and the artifact xxxx has not been downloaded from it before. 

  

这时你应该检查一下你maven是否允许在离线状态下,可检查个地方:

  1. maven的setting.xml  
    <offline>false</offline>
  2. 还有idea的一个maven配置项
    1.   这时,idea应该就会自动下载jar包了
原文地址:https://www.cnblogs.com/wqh17/p/10231831.html