今天在IDEA中调试程序时想看一个依赖类的源码,可以是点击被反编译的类窗口上方的Download Source链接总是不成功,在网上查了很多办法都不管用,比如调用一下命令:
mvn dependency:sources -DdownloadSources=true
mvn dependency:resolve -Dclassifier=source
都不起作用,试了几次不成功后,忽然发现在执行上面命令时有很多下载动作,但是下载字节为 (0 B at 0 B/s)
比如
Downloading from aliyunmaven: https://maven.aliyun.com/repository/public/org/xmlunit/xmlunit-core/2.6.4/xmlunit-core-2.6.4-sources.jar
Downloaded from aliyunmaven: https://maven.aliyun.com/repository/public/org/xmlunit/xmlunit-core/2.6.4/xmlunit-core-2.6.4-sources.jar (0 B at 0 B/s)
我觉得可能是maven repository有问题,然后在setting里,如图找到并点击3,重置remote jar repositories,问题得到解决:

image.png