如何使用 Bazel 在 Android 项目中导入 OrmLite?

How to import OrmLite in Android project using Bazel?

我正在尝试在使用 Bazel 构建系统的 Android 项目中导入 Ormlite。

这是我在 WORKSPACE 文件中所做的,

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",
    ],

我将这些依赖项导入 BUILD 文件中,

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

我收到这个错误,

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

您需要在系统上安装 java 到 运行 coursier 以获取依赖项。 Follow these steps 下载 OpenJDK。