java.lang.runtimeException与Bazel

问题描述 投票:0回答:1

我们有一个monorepo,最近我们添加了将与Bazel一起使用的Maven_repos。我们正在使用Quarkus 2.9.2.final。因此,我计划使用Quarkus创建一个CLI应用程序。但是每当我运行它们时,我都会得到运行时例外。按照我的代码看起来像-

Build.Bazel

load("@rules_java//java:defs.bzl", "java_binary", "java_library")
load("//build/bazel/rule_app_launcher:task_master.bzl", "tm_task")

java_binary(
    name = "MyApp",
    srcs = ["Main.java"],
    main_class = "<package to the Main class>.Main",
    resources = ["<references to the application properties>"],
    visibility = ["//visibility:public"],
    deps = [
        "@maven//:io_quarkus_quarkus_arc",
        "@maven//:io_quarkus_quarkus_core",
    ],
)

main.java

import io.quarkus.runtime.Quarkus;
import io.quarkus.runtime.QuarkusApplication;
import io.quarkus.runtime.annotations.QuarkusMain;

@QuarkusMain
public class Main {

    public static void main(String... args) {
        Quarkus.run(HelloWorldMain.class, args);
    }


    public class HelloWorldMain implements QuarkusApplication {
        @Override
        public int run(String... args) throws Exception {
            System.out.println("Hello " + args[0]);
            return 0;
        }
    }

}
tollow是我在运行Bazel运行时遇到的错误//:myApp

Exception in thread "main" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at io.quarkus.launcher.QuarkusLauncher.launch(QuarkusLauncher.java:58) at io.quarkus.runtime.Quarkus.launchFromIDE(Quarkus.java:97) at io.quarkus.runtime.Quarkus.run(Quarkus.java:84) at io.quarkus.runtime.Quarkus.run(Quarkus.java:41) at <package to the Main class>.Main.main(Main.java:12) Caused by: java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at io.quarkus.launcher.QuarkusLauncher.launch(QuarkusLauncher.java:56) ... 4 more Caused by: java.lang.IllegalStateException: Failed to locate project dir for /home/User123/.cache/bazel/_bazel_User123/b0cc32ca6725cc3e1476fd4087bd3d1d/execroot/app/bazel-out/k8-fastbuild/bin/<component path>/MyApp.jar at io.quarkus.bootstrap.IDELauncherImpl.launch(IDELauncherImpl.java:38) ... 9 more
对解决此问题的任何线索进行评价。
thanks.

你想知道吗?我有一个确切的问题。
java quarkus bazel bazel-java
1个回答
0
投票

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.