This is not directly a Bazel problem, however since it happens when running Bazel on relatively generic machine setup that should be supported (Ubuntu 15.04, OpenJDK 1.8.0_45), and since there's little information on how to debug and fix properly, I'm documenting it here:
When I tried to start using Closure library build rules, I got the following error:
ERROR: /home/ivan/foo/BUILD:10:1: no such package '@closure_library//': Error cloning repository: https://github.com/google/closure-library.git: cannot open git
-upload-pack and referenced by '//foo:foo_lib'.
The string cannot open git-upload-pack
seems to be connected with network connectivity problems, often related to going through proxy, etc. However in my case I knew that I'm not going through a proxy.
Unfortunately, JGit-related error reporting in GitCloner.java does not let one see the root causes (which are hidden in the long Java stack trace).
To debug this, follow the instructions to patch GitCloner.java, rebuild Bazel, try to build your target again. This time you'll get a long stack trace which hopefully would provide some clues. In my case it showed
Caused by: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
This is often associated with some problem with Java certificate store.
The solution in my case was to do the following:
sudo apt-get update ca-certificates-java
sudo update-ca-certificates -f
Adding the option insides Eclipse immediately resolves the issue. To add the option
open preferences via application menu Window => Preferences (or on OSX Eclipse => Settings).
Navigate to Team => Git => Configuration
click Add entry..., then put http.sslVerify in the key box and false in the value box.
在Eclipse内部添加选项可以立即解决该问题。添加选项
通过应用程序菜单窗口=>首选项(或在OSX Eclipse =>设置上)打开首选项。
导航到Team => Git => Configuration,
单击Add entry ...,然后将http.sslVerify放在密钥框中,将false放在值框中。
have no effect
Most helpful comment
Adding the option insides Eclipse immediately resolves the issue. To add the option
open preferences via application menu Window => Preferences (or on OSX Eclipse => Settings).
Navigate to Team => Git => Configuration
click Add entry..., then put http.sslVerify in the key box and false in the value box.