-
Notifications
You must be signed in to change notification settings - Fork 304
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
Java: download sources for external dependencies #42
Comments
This is basically the same issue as #31. The bazel plugin only sees the output from bazel, which doesn't include the sources. Until that's supported more naturally by bazel, you'll need a workaround. The gerrit project has an example of this, which should work in conjunction with the bazel IntelliJ plugin: |
Thanks! |
I'm not sure I understand. Are you saying that if I use this skylark rule instead of the built-in |
That's right -- the skylark extension will create a java_import target with the relevant srcjar attribute value filled in. That Skylark extension just overrides the behaviour of maven_jar, so you'll need to load it in the WORKSPACE file (see the gerrit project's WORKSPACE file as an example). Then just leave all your maven_jar targets as they were. You can test it by loading that gerrit project in IntelliJ (you'll need Bazel 0.4.4 or later, and IJwB 2017.01.09 or later). |
I tried using a modified version of gerrit's maven_jar replacement, and found that IntelliJ complained that the jar's bytecode didn't match what was being referenced by the source. It seems like there's some confusion going on between the ijar and the source jar? |
Not "confusion" exactly, but Bazel does configure IntelliJ to use ijars by default. I believe that's on purpose? |
I'd suggest having this issue open until it has been resolved without requiring overriding maven_jar. |
This change should be made in Bazel -- the open issue is bazelbuild/bazel#308 |
Let's say I have used
maven_jar()
in my WORKSPACE to make apache httpclient available to declare as a dependency, and that I am able to build my project without any problems with code using this external dependency.When I in IntelliJ try to Go to → Implementation on a class from the dependency and click on "Download" in the bar at the top of the opened class file, I get an error
Sources not found: Sources for 'httpclient-4.5.2-ijar.jar' not found
.I suspect this is due to the ijar trick bazel is doing?https://github.com/bazelbuild/bazel/tree/master/third_party/ijar
The functionality to easy download sources for external dependencies is a great feature, and I miss it very much.
Should this be working? Am I missing something?
Bazel version: 0.4.3
The text was updated successfully, but these errors were encountered: