eqy
March 18, 2019, 11:11pm
1
I’m working on porting libtvm.so
style support on Android to an existing TFLite app that uses the bazel build system. I’m a complete novice here, so does anyone have experience with how to get import ml.dmlc.tvm...
(adding tvm4j as a dependency) to work here? Is there some incantation of WORKSPACE
and BUILD
I need?
Right now I get something like
Failed to fetch Maven dependency: Could not find artifact ml.dmlc.tvm:tvm4j-core:jar:0.0.1-SNAPSHOT in ml_dmlc_tvm_tvm4j_core
This is probably because I am doing something totally wrong in the WORKSPACE file e.g.,
maven_jar(
name="ml_dmlc_tvm_tvm4j_core",
artifact="ml.dmlc.tvm:tvm4j-core:0.0.1-SNAPSHOT",
)
My guess is that it is not trying to query the local maven packages?
CC @yzhliu @PariksheetPinjari909
yzhliu
March 18, 2019, 11:28pm
2
Did you do make jvminstall
? I don’t know bazel but I guess there’s an option for enable local maven repo?
eqy
March 18, 2019, 11:39pm
3
Yes, I have built many versions of the current android deploy demo and make jvminstall has worked for those. Searching for bazel and local maven repo doesn’t seem to turn up anything for me. I think there is an option to specify server
in maven_jar
, but I am not sure what is a reasonable setting here.
eqy
March 18, 2019, 11:52pm
4
Looks like this obscure issue is in the right direction:
opened 11:00AM - 25 Sep 17 UTC
closed 01:34PM - 09 Jan 18 UTC
### Description of the problem / feature request / question:
I am using bazel… in a restricted network environment where `maven.org` couldn't be accessed BUT an internal maven mirror/repo is provided. My `~/.m2/settings.xml` is correctly configured, and all of `gradle`, `mvn`, intellij can download artifacts from internal mirror/repo read from `settings.xml` without problems.
- Expectation: bazel can also automatically download artifacts using configurations in `~/.m2/settings.xml`.
- Actual behaviour: bazel still downloads things from `https://repo1.maven.org/maven2`.
### If possible, provide a minimal example to reproduce the problem:
Use a modified version of official https://github.com/bazelbuild/examples/tree/master/java-maven by removing `maven_server()`.
```bash
$ git clone https://github.com/bazelbuild/examples/
$ cd examples/java-maven
$ cat > WORKSPACE << EOF
maven_jar(
name = "com_google_guava_guava",
artifact = "com.google.guava:guava:18.0",
)
EOF
$ bazel info release
WARNING: ignoring http_proxy in environment.
release 0.6.0rc3
$ bazel build :java-maven
WARNING: ignoring http_proxy in environment.
ERROR: ~/examples/java-maven/BUILD:3:1: no such package '@com_google_guava_guava//jar': Failed to fetch Maven dependency: Could not transfer artifact com.google.guava:guava:jar:18.0 from/to com_google_guava_guava (https://repo1.maven.org/maven2/): connect timed out and referenced by '//:java-maven-lib'
ERROR: Analysis of target '//:java-maven' failed; build aborted
INFO: Elapsed time: 10.749s
FAILED: Build did NOT complete successfully (9 packages loaded)
```
```bash
$ cat ~/.m2/settings.xml # internal repo working for gradle and mvn
<settings>
<mirrors>
<mirror>
<id>internal mirror</id>
<url>http://maven_internal.example.com/</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
...
</settings>
```
if I manually add lines below to `WORKSPACE`, bazel works. **But I don't want to do this workaround because it should not be checked into version control.**
```
maven_server(
name = "default",
url = "http://maven_internal.example.com/",
)
```
### Environment info
* Operating System:
Ubuntu 16.04 LTS
* Bazel version (output of `bazel info release`):
```bash
$ sudo apt-get install bazel # using official testing repo as of 20170924
$ bazel info release
WARNING: ignoring http_proxy in environment.
release 0.6.0rc3
```
### Have you found anything relevant by searching the web?
(e.g. [StackOverflow answers](http://stackoverflow.com/questions/tagged/bazel),
[GitHub issues](https://github.com/bazelbuild/bazel/issues),
email threads on the [`bazel-discuss`](https://groups.google.com/forum/#!forum/bazel-discuss) Google group)
According to [official doc](https://docs.bazel.build/versions/master/be/workspace.html#specifying-a-default-server), shouldn't bazel follow `~/.m2/settings.xml`??
They seem to be relevant, however I still don't know how to "fix" the problem:
- https://stackoverflow.com/questions/43404421/how-to-specify-a-maven-repository-for-the-maven-aar-rule
- https://github.com/bazelbuild/bazel/blob/master/tools/build_defs/repo/maven_rules.bzl