Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Honestly Bazel and Java is actually a really nice experience. Pull in third party stuff from https://github.com/bazelbuild/rules_jvm_external. There is built in support for uber jar builds by adding a _deploy.jar suffix to binary jars. Protobuf and other codegen is super easy!


Here is an example project that even downloads the right JDK automatically for you: https://github.com/rockwotj/SyllabusDB


You should always configure Bazel this way, i.e `remotejdk`. This helps with portability between machines for one but also helps you be ready for things like Remote Build Execution which is where Bazel really has an advantage over other build systems which aren't natively distributed aware.


+1

Bazel and monorepo are a bit exotic to most enterprise Java devs, but now that I've experienced it, I'll never go back to Gradle or Maven or sbt.


maven can do monorepos pretty easily i thought. The potential benefit of bazel is the better level of cache compiled artifacts that maven doesn't seem to handle very well (and so you almost always end up recompiling everything just in case...)


There is still a bit of work to be done to make it really nice and rules_kotlin tends to lag a bit behind if Kotlin is your poison.

One area that needs work that I haven't had time to invest more in yet is a proper split layer OCI image build with rules_oci similar to what Jib does out of the box. Right now the example in the repo just dumps in the _deploy.jar which works but results in one fat layer that has to be pushed every time even if only app code changed.

Overall though I think Bazel is awesome.

I still end up using Gradle but try not to use it for projects other people need to work on, Gradle's comprehensibility cliff is worse than Bazel IMO and the more constrained nature of Bazel keeps people from making too bad of a mess.


I tried it once but didn't have much joy using bazel under MacOS - has this changed? I've never had an issue with maven on non-linux platforms which is what you come to expect with the JVM ecosystem.

Although I've limited experience, I actually much prefer the overall bazel approach/design than that of maven. That experience was with a large C++ project but it only required building on Linux. However I've much more maven experience so can always figure my way out of maven issues - while I am much more inclined to just give up when I get bazel build errors.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: