簡體   English   中英

我可以使用 _deploy.jar 使 bazel java_binary 規則替換默認 jar

[英]Can I make bazel java_binary rule replace default jar with with _deploy.jar

我想讓 Bazel 始終構建 _deploy jar 並將其替換為默認創建的 jar。

原因是我想使用pomgen插件將“uber”jar 安裝到 .m2 存儲庫中,以便在我正在遷移的 maven 項目中使用。

使用此配置:

java_library(
    name = "foo-lib",
    srcs = glob(["src/main/java/**/*.java"]),
    resources = glob(["src/main/resources/**"]),
    deps = [
        "@maven//:junit_junit",
    ]
)

java_binary(
    name = "foo",
    main_class = "FooMain",
    runtime_deps = [":foo-lib"]
)

The foo_deploy.jar is created only when I call bazel build //foo:foo_deploy.jar , but I did not see a way to specify to pomgen to deploy this jar instead of the foo.jar file.

Actually, after digging in a bit to the pomgen plugin, it seems that they automatically deploy the foo-deploy.jar if no libfoo.jar found... https://github.com/salesforce/pomgen/blob/a54506845c554ef2ef795146bb662701f33c52d2/maven /maven_functions.sh

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM