bazel为目标的所有依赖项打印版本/标签/哈希

时间:2019-08-22 18:19:25

标签: bazel

我遇到了目标目标的构建错误。我检查了代码,没有发现任何错误。我怀疑我可能在看错误版本的代码。是否可以打印出目标所依赖的所有代码包的标记/版本/哈希?

1 个答案:

答案 0 :(得分:0)

bazel query 'deps(//my:target)' --nohost_deps --noimplicit_deps --output=build

这将以BUILD文件格式打印目标依赖的所有显式依赖项的BUILD目标。这是在真实项目中运行该命令的示例输出:

# /home/user/code/rules_jvm_external/tests/integration/BUILD:12:1
java_test(
  name = "GlobalArtifactExclusionsTest",
  deps = ["@global_exclusion_testing//:com_diffplug_durian_durian_core", "@global_exclusion_testing//:com_google_guava_guava", "@global_exclusion_testing//:com_squareup_okhttp3_okhttp", "@maven//:org_hamcrest_hamcrest", "@maven//:org_hamcrest_hamcrest_core"],
  srcs = ["//tests/integration:GlobalArtifactExclusionsTest.java"],
  test_class = "com.jvm.external.GlobalArtifactExclusionsTest",
)

# /home/user/.cache/bazel/_bazel_user/8484bc4fff18ee4a905b69a9ddb0e143/external/maven/BUILD:103:1
jvm_import(
  name = "org_hamcrest_hamcrest_core",
  tags = ["maven_coordinates=org.hamcrest:hamcrest-core:2.1"],
  jars = ["@maven//:v1/https/jcenter.bintray.com/org/hamcrest/hamcrest-core/2.1/hamcrest-core-2.1.jar"],
  deps = ["@maven//:org_hamcrest_hamcrest"],
)

# /home/user/.cache/bazel/_bazel_user/8484bc4fff18ee4a905b69a9ddb0e143/external/maven/BUILD:115:1
jvm_import(
  name = "org_hamcrest_hamcrest",
  tags = ["maven_coordinates=org.hamcrest:hamcrest:2.1"],
  jars = ["@maven//:v1/https/jcenter.bintray.com/org/hamcrest/hamcrest/2.1/hamcrest-2.1.jar"],
  deps = [],
)

# /home/user/.cache/bazel/_bazel_user/8484bc4fff18ee4a905b69a9ddb0e143/external/global_exclusion_testing/BUILD:79:1
jvm_import(
  name = "com_squareup_okhttp3_okhttp",
  tags = ["maven_coordinates=com.squareup.okhttp3:okhttp:3.14.1"],
  jars = ["@global_exclusion_testing//:v1/https/repo1.maven.org/maven2/com/squareup/okhttp3/okhttp/3.14.1/okhttp-3.14.1.jar"],
  deps = ["@global_exclusion_testing//:com_squareup_okio_okio"],
)

# /home/user/.cache/bazel/_bazel_user/8484bc4fff18ee4a905b69a9ddb0e143/external/global_exclusion_testing/BUILD:91:1
jvm_import(
  name = "com_squareup_okio_okio",
  tags = ["maven_coordinates=com.squareup.okio:okio:1.17.2"],
  jars = ["@global_exclusion_testing//:v1/https/repo1.maven.org/maven2/com/squareup/okio/okio/1.17.2/okio-1.17.2.jar"],
  deps = [],
)

# /home/user/.cache/bazel/_bazel_user/8484bc4fff18ee4a905b69a9ddb0e143/external/global_exclusion_testing/BUILD:52:1
jvm_import(
  name = "com_google_guava_guava",
  tags = ["maven_coordinates=com.google.guava:guava:27.0-jre"],
  jars = ["@global_exclusion_testing//:v1/https/repo1.maven.org/maven2/com/google/guava/guava/27.0-jre/guava-27.0-jre.jar"],
  deps = ["@global_exclusion_testing//:com_google_guava_listenablefuture", "@global_exclusion_testing//:com_google_code_findbugs_jsr305", "@global_exclusion_testing//:com_google_guava_failureaccess", "@global_exclusion_testing//:com_google_errorprone_error_prone_annotations", "@global_exclusion_testing//:org_checkerframework_checker_qual"],
)

# /home/user/.cache/bazel/_bazel_user/8484bc4fff18ee4a905b69a9ddb0e143/external/global_exclusion_testing/BUILD:102:1
jvm_import(
  name = "org_checkerframework_checker_qual",
  tags = ["maven_coordinates=org.checkerframework:checker-qual:2.5.2"],
  jars = ["@global_exclusion_testing//:v1/https/repo1.maven.org/maven2/org/checkerframework/checker-qual/2.5.2/checker-qual-2.5.2.jar"],
  deps = [],
)

# /home/user/.cache/bazel/_bazel_user/8484bc4fff18ee4a905b69a9ddb0e143/external/global_exclusion_testing/BUILD:68:1
jvm_import(
  name = "com_google_guava_listenablefuture",
  tags = ["maven_coordinates=com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava"],
  jars = ["@global_exclusion_testing//:v1/https/repo1.maven.org/maven2/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar"],
  deps = [],
)

# /home/user/.cache/bazel/_bazel_user/8484bc4fff18ee4a905b69a9ddb0e143/external/global_exclusion_testing/BUILD:41:1
jvm_import(
  name = "com_google_guava_failureaccess",
  tags = ["maven_coordinates=com.google.guava:failureaccess:1.0"],
  jars = ["@global_exclusion_testing//:v1/https/repo1.maven.org/maven2/com/google/guava/failureaccess/1.0/failureaccess-1.0.jar"],
  deps = [],
)

# /home/user/.cache/bazel/_bazel_user/8484bc4fff18ee4a905b69a9ddb0e143/external/global_exclusion_testing/BUILD:30:1
jvm_import(
  name = "com_google_errorprone_error_prone_annotations",
  tags = ["maven_coordinates=com.google.errorprone:error_prone_annotations:2.2.0"],
  jars = ["@global_exclusion_testing//:v1/https/repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations/2.2.0/error_prone_annotations-2.2.0.jar"],
  deps = [],
)

# /home/user/.cache/bazel/_bazel_user/8484bc4fff18ee4a905b69a9ddb0e143/external/global_exclusion_testing/BUILD:19:1
jvm_import(
  name = "com_google_code_findbugs_jsr305",
  tags = ["maven_coordinates=com.google.code.findbugs:jsr305:3.0.2"],
  jars = ["@global_exclusion_testing//:v1/https/repo1.maven.org/maven2/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar"],
  deps = [],
)

# /home/user/.cache/bazel/_bazel_user/8484bc4fff18ee4a905b69a9ddb0e143/external/global_exclusion_testing/BUILD:8:1
jvm_import(
  name = "com_diffplug_durian_durian_core",
  tags = ["maven_coordinates=com.diffplug.durian:durian-core:1.2.0"],
  jars = ["@global_exclusion_testing//:v1/https/repo1.maven.org/maven2/com/diffplug/durian/durian-core/1.2.0/durian-core-1.2.0.jar"],
  deps = [],
)