Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Can't package the files in dist folder into jar package #1896

Open
zacker330 opened this issue Aug 17, 2024 · 0 comments
Open

[Bug]: Can't package the files in dist folder into jar package #1896

zacker330 opened this issue Aug 17, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@zacker330
Copy link

zacker330 commented Aug 17, 2024

What happened?

I have a bazel project that include java code and react code.

I am going to include the react ui build result into my java project's resource folder while building.

BUILD.bazel in the package of react code

js_run_binary(
    name = "build",
    srcs = RUNTIME_DEPS,
    args = ["build"],
    mnemonic = "ViteBuild",

    out_dirs = ["dist"],
    tool = ":vite",
    visibility = ["//server:__subpackages__"],
)

BUILD.bazel in the package of java code. As the code shows it should package the contents of dist out_dirs.

java_binary(
    name = "app_lib",
    main_class = "codes.showme.server.Main",
    create_executable = False,
    resources = [
        # I am going to include the react ui dist conent into my java project's resource folder while building
        "//web-react-ui:build",
    ],
    runtime_deps = [
        ":lib",
    ],
)

But when I unpackage the java jar, the dist folder is empty.

Is there any way to package all contents into the jar file? Thank you.

Version

Development (host) and target OS/architectures:

Output of bazel --version: 7.2.1

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file:

bazel_dep(name = "aspect_bazel_lib", version = "2.7.7")
bazel_dep(name = "aspect_rules_lint", version = "1.0.0-rc4")
bazel_dep(name = "aspect_rules_jest", version = "0.22.0-rc0")
bazel_dep(name = "aspect_rules_js", version = "2.0.0-rc1")
bazel_dep(name = "aspect_rules_swc", version = "2.0.0-rc0")
bazel_dep(name = "aspect_rules_ts", version = "3.0.0-rc0")
bazel_dep(name = "aspect_rules_rollup", version = "2.0.0-rc0")
bazel_dep(name = "aspect_rules_webpack", version = "0.16.0-rc0")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_nodejs", version = "6.1.1")

Language(s) and/or frameworks involved: Java & TypeScript

How to reproduce

No response

Any other information?

No response

@zacker330 zacker330 added the bug Something isn't working label Aug 17, 2024
@zacker330 zacker330 changed the title [Bug]: [Bug]: Can't package the files in dist folder into jar package Oct 27, 2024
@zacker330 zacker330 reopened this Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant