Search code examples
androidbazelormlite

How to import OrmLite in Android project using Bazel?


I am trying to import Ormlite in my Android project which is using Bazel build system.

This is what I did in WORKSPACE file,

maven_install(
    artifacts = [
        "com.j256.ormlite:ormlite-core:4.17",
        # ...
    ],
    repositories = [
        "https://maven.google.com",
        "https://jcenter.bintray.com",
    ],

maven_install(
    artifacts = [
        "com.j256.ormlite:ormlite-android:5.1",
        # ...
    ],
    repositories = [
        "https://maven.google.com",
        "https://jcenter.bintray.com",
    ],

And I am importing these dependencies in BUILD file as,

"@maven//:com_j256_ormlite_ormlite_core",
"@maven//:com_j256_ormlite_ormlite_android",

I am getting this error,

no such package '@maven//': Unable to run coursier: /my/home/.cache/bazel/_bazel_sensen/48
    ...ad891aa751c50/external/maven/coursier: line 2: exec: java: not found

ERROR


Solution

  • You'll need java installed on your system to run coursier to fetch the dependencies. Follow these steps to download OpenJDK.