Open ceronman opened 5 years ago
You can have a look at how it's done here: https://github.com/google/startup-os/tree/master/tools/deps
It's based on johnynek/bazel-deps. See this issue on a comparison between bazelbuild/migration-tooling and johnynek/bazel-deps.
The
generate_workspace
tool generates bothmaven_jar
targets and alsojava_library
targets.The
java_library
targets seem to contain transitive dependencies, for example, when generating dependencies for theorg.asynchttpclient:async-http-client:2.5.2
artifact, I see that ajava_library
target is created that looks like this:At first glance, it seems very handy to have these generated
java_library
targets containing all the transitive dependencies of a given maven jar. However, given that these are declared asruntime_deps
, the generated library is not very useful because I can't use it as a single dependency in other targets. I still need to include all the transitive dependencies manually. So I don't understand the point of generatedjava_libray
targets asmaven_jar
s could be used directly.One solution to this problem would be to make the
java_library
targets export the transitive dependencies. For example like this:In this way, I could easily declare
org_asynchttpclient_async_http_client
as my dep and make sure all it's transitive dependencies will come with it.Note: I'm new to Bazel. I apologize if this doesn't make sense :)