Comments (16)
Thanks for the repro repo. I get the same error as you.
This looks like an issue with our use of FindBinary here:
Hardcoding javaParserPath
to "external/contrib_rules_jvm/java/src/com/github/bazel_contrib/contrib_rules_jvm/javaparser/generators/Main" works is your case (and you could patch this in until we find a solution) but this will not work long term I imagine.
I will try to have a look at what is going on this week.
from rules_jvm.
Can you share your version of Bazel and ideally a repo with a repro?
from rules_jvm.
Can you share your version of Bazel and ideally a repo with a repro?
I've tried 6.3.0, 6.1.0 and 5.4.1.
I've been able to replicate here:
https://github.com/KrisJohnstone/spring-petclinic/tree/bazel-example
from rules_jvm.
That worked a treat. Thanks @stevebarrau
EDIT: Did you want me to close this Issue or leave it open for the fix?
from rules_jvm.
@KrisJohnstone can you give #216 a try and see if this resolve this issue?
from rules_jvm.
I get the following weirdly:
/private/var/tmp/_bazel_krisjohnstone/3337dddeaeeddd03860ac735ca6cd027/execroot/main/bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin/external/contrib_rules_jvm/java/src/com/github/bazel_contrib/contrib_rules_jvm/javaparser/generators/Main: Cannot locate runfiles directory. (Set $JAVA_RUNFILES to inhibit searching.)
10:28PM FTL external/contrib_rules_jvm/java/gazelle/configure.go:133 > could not start javaparser error="failed to start / connect to javaparser server: failed to read port from javaparser server - maybe it crashed: timed out waiting for port file to be written by javaparser server"
from rules_jvm.
Same here - after trying #216
from rules_jvm.
Same here too with #216. I will add: I'm using Bzlmod.
/private/var/tmp/_bazel_ar3s3ru/3efe07ce4123e4dfef2f8db5ddd896ff/execroot/_main/bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin/external/contrib_rules_jvm~override/java/src/com/github/bazel_contrib/contrib_rules_jvm/javaparser/generators/Main: Cannot locate runfiles directory. (Set $JAVA_RUNFILES to inhibit searching.)
8:46AM FTL external/contrib_rules_jvm~override/java/gazelle/configure.go:133 > could not start javaparser error="failed to start / connect to javaparser server: failed to read port from javaparser server - maybe it crashed: timed out waiting for port file to be written by javaparser server"
Error: bazel exited with exit code: 1
from rules_jvm.
I'll say I'm using bzlmod as well and am hitting the same issue. Mine is for using the gazelle
plugin, but the error is the same.
For reproducibility:
bazelrc:
common --java_language_version=remotejdk_11 --tools_java_runtime_version=remotejdk_11 --tool_java_language_version=11
MODULE.bazel
module(name = "test")
bazel_dep(name = "gazelle", version = "0.34.0")
bazel_dep(name = "contrib_rules_jvm", version = "0.18.0")
BUILD.bazel:
load("@gazelle//:def.bzl", "DEFAULT_LANGUAGES", "gazelle", "gazelle_binary")
gazelle(
name = "gazelle",
gazelle = ":gazelle_bin",
)
gazelle_binary(
name = "gazelle_bin",
languages = DEFAULT_LANGUAGES + [
"@contrib_rules_jvm//java/gazelle",
],
)
Running Gazelle:
bazel run //:gazelle ✔
INFO: Analyzed target //:gazelle (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //:gazelle up-to-date:
bazel-bin/gazelle-runner.bash
bazel-bin/gazelle
INFO: Elapsed time: 0.039s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/gazelle
2:09PM FTL external/contrib_rules_jvm~0.18.0/java/gazelle/configure.go:133 > could not start javaparser error="failed to start / connect to javaparser server: failed to find javaparser in runfiles"
from rules_jvm.
I've opened #224 to fix the issue with locating javaparser
.
However, in my specific case, I'm hitting a different error now: Cannot locate runfiles directory.
Can some of you try on your side my branch version and report if you're hitting the same issue?
You can use the following override if you're on Bzlmod
git_override(
module_name = "contrib_rules_jvm",
remote = "https://github.com/ar3s3ru/rules_jvm",
commit = "b01bab003632dc0624a4e8ff1d4354881ee95a7c",
)
Some details on my local project:
- Bazel: 6.4.0
- Bzlmod on
Error output:
Loading:
Loading:
Loading: 0 packages loaded
Analyzing: target //:gazelle (0 packages loaded, 0 targets configured)
INFO: Analyzed target //:gazelle (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
[0 / 7] [Prepa] BazelWorkspaceStatusAction stable-status.txt
Target //:gazelle up-to-date:
bazel-bin/gazelle-runner.bash
bazel-bin/gazelle
INFO: Elapsed time: 1.315s, Critical Path: 1.16s
INFO: 3 processes: 1 internal, 2 darwin-sandbox.
INFO: Build completed successfully, 3 total actions
INFO: Running command line: bazel-bin/gazelle
�[90m2:07PM�[0m �[32mINF�[0m �[1mexternal/contrib_rules_jvm~override/java/gazelle/private/servermanager/servermanager.go:70�[0m�[36m >�[0m starting javaparser with command �[36mcmd=�[0m"/private/var/tmp/_bazel_ar3s3ru/3efe07ce4123e4dfef2f8db5ddd896ff/execroot/_main/bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin/external/contrib_rules_jvm~override/java/src/com/github/bazel_contrib/contrib_rules_jvm/javaparser/generators/Main --jvm_flag=-Dorg.slf4j.simpleLogger.defaultLogLevel=info --server-port-file-path /var/folders/dg/jf2qkwmn0qg4qklxq9c84j0w0000gn/T/gazelle-javaparser1138877067/port --workspace /Users/ar3s3ru/Code/*** --idle-timeout 30"
/private/var/tmp/_bazel_ar3s3ru/3efe07ce4123e4dfef2f8db5ddd896ff/execroot/_main/bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin/external/contrib_rules_jvm~override/java/src/com/github/bazel_contrib/contrib_rules_jvm/javaparser/generators/Main: Cannot locate runfiles directory. (Set $JAVA_RUNFILES to inhibit searching.)
�[90m2:07PM�[0m �[1m�[31mFTL�[0m�[0m �[1mexternal/contrib_rules_jvm~override/java/gazelle/configure.go:133�[0m�[36m >�[0m could not start javaparser �[36merror=�[0m�[31m"failed to start / connect to javaparser server: failed to read port from javaparser server - maybe it crashed: timed out waiting for port file to be written by javaparser server"�[0m
Error: bazel exited with exit code: 1
from rules_jvm.
Seems like the error I was mentioning above was happening since JAVA_RUNFILES
was not being passed to the javaparser/generators/Main
's java_binary
invoked by Gazelle's plugin, due to this: https://github.com/bazelbuild/bazel/blob/492ee4c91b507bc07f63da1bafa1696cbcf75bd2/src/main/java/com/google/devtools/build/lib/bazel/rules/java/java_stub_template.txt#L185
(More context here: https://bazelbuild.slack.com/archives/C01HMGN77Q8/p1701887957242259)
My latest commit apparently fixes that, at least on my private repro project: b01bab0
from rules_jvm.
Great to see this is fixed! 🎉 Is there already a plan for when a new release including this will get cut?
from rules_jvm.
I just released v0.20.0 including this fix.
from rules_jvm.
Amazing, thanks for the quick turnaround on this!
from rules_jvm.
@illicitonion I don't see that version in BCR 👀
from rules_jvm.
It looks like we don't have automatic BCR mirroring enabled - you can following along at bazelbuild/bazel-central-registry#1268 to see how our progress at getting automatic mirroring working goes.
from rules_jvm.
Related Issues (20)
- Fetching dependencies for JUnit5 runner tries to use local java HOT 1
- Allow setting SecurityManager
- Support exclusions in addition to test_suffixes in java_test_suite HOT 1
- Can't clone it in our windows kokoro jobs HOT 1
- Duplicate artifacts versions
- Checkstyle tests don't work with a generated checkstyle.xml HOT 2
- Cannot be used with `--override_repository`: cannot load '@@rules_java//java:repositories.bzl': no such file HOT 2
- Not able to download contrib_rules_jvm via bzlmod......failing to resolve transitive dependencies HOT 1
- No maven lockfile for bzlmod
- java_test_suite silently drops `data` HOT 2
- SpotBugs targets fail when we have more than one plugin in Unix-like systems
- Gazelle fails on Windows with "javaparser/generators/Main: file does not exist"
- Gazelle fails on Windows with "panic: runtime error: invalid memory address or nil pointer dereference"
- Gazelle fails on Windows with "java.nio.file.InvalidPathException: Illegal char <:> at index 2" HOT 1
- Run gazelle tests on CI on Windows
- srcs is updated with the OS-specific path separator
- Re-add tests for "missing maven_install.json leads to a useful warning" case
- Don't fail silently when running a junit4 test in junit5 test suite w/o vintage HOT 1
- Sharding does not work with ParametrizedTest in java_junit5_test
- Fixed list of top-level package name is flawed for uncommon TLD's HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rules_jvm.