I'm trying to complie a bazle project, Twitter Heron. There is a maven_server I can't access in the terminal in my country :
ERROR: /home/xxx/heron/heron/healthmgr/src/java/BUILD:56:1: no such package '@org_apache_thrift_libthrift//jar': Failed to fetch Maven dependency: Could not transfer artifact org.apache.thrift:libthrift:jar:0.5.0-1 from/to org_apache_thrift_libthrift (http://maven.twttr.com): Connect to maven.twttr.com:80 timed out and referenced by '//heron/healthmgr/src/java:healthmgr-unshaded'. ERROR: Analysis of target '//scripts/packages:binpkgs' failed; build aborted. INFO: Elapsed time: 10.867s
So I download the jar needed manually from the site, put it in my local maven repository, and change the maven_server in WORKSPACE to central maven repository. But then it try to find the jar, which only available in the specific remote repository, from central maven repository. I get this:
ERROR: /home/xxx/heron/heron/healthmgr/src/java/BUILD:56:1: no such package '@org_apache_thrift_libthrift//jar': Failed to fetch Maven dependency: Could not find artifact org.apache.thrift:libthrift:jar:0.5.0-1 in org_apache_thrift_libthrift (http://central.maven.org/maven2) and referenced by '//heron/healthmgr/src/java:healthmgr-unshaded'. ERROR: Analysis of target '//scripts/packages:binpkgs' failed; build aborted. INFO: Elapsed time: 1.083s
Can bazel find dependencies in my local maven repository? Or I put the jar in a wrong path? Or is there any other thing wrong?
ls ~/.m2/repository/org/apache/thrift/libthrift/0.5.0-1
libthrift-0.5.0-1.jar libthrift-0.5.0-1.pom libthrift-0.5.0-1-sources.jar
Heron uses the native maven_jar rule which doesn't use
mvn
or.m2
for that matter. As far as I can tell your options are:BTW, as a side note the skylark version of maven_jar does use
mvn
and so.m2
but I really wouldn't recommend it as it's not 100% clear this will be recommended in the future.One of the main reasons is that bazel doesn't provision the maven binary so you now have to somehow make sure everyone building the project is using the same binary.