Summary
mongo-scala-bson and mongo-scala-driver have invalid characters in the "Automatic-Module-Name" field of their META-INF/MANIFEST.MF files.
This causes some builds to fail with the error "cannot determine module name" . This happens on a Bazel project using JDK 17.
This is present in the latest version of these two libraries, i.e. version 4.11.0.
How to Reproduce
- Download the jar file for mongo-scala-driver or mongo-scala-bson.
- Extract the jar file e.g.:
unzip ./mongo-scala-bson_2.13-4.11.0.jar - View MANIFEST.MF:
cat META-INF/MANIFEST.MF - Look at the content of the Automatic-Module-Name field e.g.
Automatic-Module-Name: org.mongodb.scala.mongo-scala-bson
and
Automatic-Module-Name: org.mongodb.scala.mongo-scala-driver - Notice the invalid "-" character in the module name.
Additional Background
The character "-" is not valid. For a description of the valid characters see:
- https://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html
- https://docs.oracle.com/javase%2F9%2Fdocs%2Fapi%2F%2F/java/lang/module/ModuleFinder.html
_Similar issue: https://jira.mongodb.org/browse/JAVA-5202_
Suggested fix: replace "-" with a dot: ".".