facebook / facebook/buck2

How to build Java libraries/binaries?

Open
#394 9 comments 7 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
4.4k
Forks
394
PR merge metrics
No merged PRs in 30d

Description

I've been experimenting with buck2 but I've been struggling to find any information on building Java. A simple java_library rule fails to build
```
java_library(
name = 'main',
srcs = ['Main.java'],
)
```
```
Error running analysis for `root//:main (prelude//platforms:default#524f8da68ea2a374)`

Caused by:
0: Error looking up configured node root//:main (prelude//platforms:default#524f8da68ea2a374)
1: Error getting configuration node of `prelude//runtime/constraints:android-host-test` within the `prelude//platforms:default#524f8da68ea2a374` configuration
2: Error running analysis for `prelude//runtime/constraints:android-host-test ()`
3: Error looking up configured node prelude//runtime/constraints:android-host-test ()
4: looking up unconfigured target node `prelude//runtime/constraints:android-host-test`
5: Error loading targets in package `prelude//runtime/constraints` for target `prelude//runtime/constraints:android-host-test`
6: Error gathering package listing for `prelude//runtime/constraints`
7: The package is invalid
8: This error was caused by the end user
9: Error listing dir `prelude//runtime/constraints`
10: Error listing directory
11: read_dir(/tmp/buck2test/prelude/runtime/constraints)
12: No such file or directory (os error 2)
Build ID: fedd29e4-2e88-42b8-aa74-d133c81e21db
Jobs completed: 46. Time elapsed: 0.1s.
BUILD FAILED
```
I'm not 100% sure what this error is caused by, I assume I need to configure a java toolchain, but I can't find anything to reference on how to do this. Is there documentation on this or projects to reference?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.