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?