2018年2月28日星期三

解决DependencyCheck的Could not connect to Central search问题

在离线的计算机中使用DependencyCheck的时候遇到了个小问题,扫描时控制台提示

Could not connect to Central search. Analysis failed.

具体的解决办法为,在扫描的命令中加入  --disableCentral 这个参数即可,即形如如下:

dependency-check.bat -f xxxx -o xxxxxxxx --log xxxxxxx --disableCentral

注意xxx是我这里随意写的。


为什么这样就能解决呢,我看了原先的错误的debug信息,这个信息在扫描的输出log文件里会有,其中有一段说明了 Central search 具体地址是 search.maven.org ,DependencyCheck 将会在这个网站搜索一些内容,而根据github上issue

https://github.com/jeremylong/DependencyCheck/issues/978

可知是禁用central就行了,在帮助信息里可以看到的