Gradle descriptor for Java 9 modules


I work on the Ceylon programming language, and we have a module system which provides:

  • module name, version
  • explicit module dependencies (required/optional, public/private, versioned)
  • private/public packages
  • metadata such as module docs, authors, license, etc…

All that info is available to Ceylon module consumers in the produced artifacts.

We can consume Maven Central artifacts too, but found the following metadata missing for Maven artifacts (because pom.xml does not support them):

  • explicit module dependencies (public/private)
  • private/public packages

Java 9 is supposed to fix this by providing the info in module-info.class, which means we should be able to combine the pom.xml and module-info.class info to extract all we need.

But the pom.xml format is not ideal, especially since it is not guaranteed to include all info, and may depend on other POMs to have all the data, making tools like Aether required to resolve metadata.

Furthermore, we have users who like to put all their .jars into a single folder in the classpath and we’re supposed to extract module metadata for them by scanning the classpath, which means we have to skip Aether and don’t have access to external pom.xml files, using only the pom.xml internal to the .jar.

It’d be great if Gradle could come up with a way to store rich module descriptors inside the .jar in a “resolved” way that would not require external lookups.

I know Cédric Champeau thinks putting descriptors inside .jar is an abomination, but I don’t see what the problem is, or how it’s worse than having that descriptor external. In both cases they’re strongly coupled and the .jar is useless without the descriptor.

Are there any plans for Gradle to generate such a descriptor in addition to the pom.xml it’s probably forced to generate for Maven Central deployment?

Thanks, cheers.