rules_proto icon indicating copy to clipboard operation
rules_proto copied to clipboard

Ensure Maven imports are tagged with maven_coordinates

Open SanjayVas opened this issue 1 year ago • 0 comments

rules_proto imports the protobuf-java library from Maven using the java_import_external macro. Unlike the sibling jvm_maven_import_external macro, this macro does not set the maven_coordinate tag which is read by rules_jvm_external in order to ensure that exported artifacts have the appropriate artifact dependencies. Not having this results in exported Maven artifacts including protobuf-java directly rather than as an artifact dependency. This can result in downstream users having duplicate copies of protobuf-java, possibly with different versions.

rules_proto should either switch to jvm_maven_import_external or specify the maven_coordinate manually.

Related interaction with rules_jvm_external

If a project depends on rules_proto for java_proto_library and also uses rules_jvm_external for other Maven dependencies, it could result in a library depending on multiple versions of protobuf-java. To avoid this, downstream projects can specify the protobuf-java targets from @com_google_protobuf in the override_targets attribute of maven_install.

SanjayVas avatar Mar 09 '23 22:03 SanjayVas