As part of our efforts to create a bazel-maven transition interop tool (that creates maven sized jars from more granular sized bazel jars) there is a need to create sources jars.
For java_binary targets there is a mechanism to create it using -src.jar suffix
e.g., for a java_binary target called foo, run bazel build //:foo-src.jar
But, using the same mechanism for java_library target named bar I get:
ERROR: no such target '//:bar-src.jar': target 'bar-src.jar' not declared in package '' (did you mean 'libbar-src.jar'?) defined by /Users/.../java_project/BUILD.
Is there a another mechanism for java_library?
As indicated by the error, the source target is called //:libbar-src.jar (with the lib prefix). See the list of outputs of java_library for reference.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With