Why can modules not be annotated?
Stephane Epardaud
stef at epardaud.fr
Tue Oct 6 12:28:54 UTC 2015
Ceylon does put most of what you list (license, versions, authors, doc)
in the module descriptor because they either specify documentation (and
like javadoc that's on the sources, not in external third-party
formats/locations), or language directives such as module imports (like
package imports in java sources, again not in external third-party
formats/locations), so while I do understand why you don't want to take
over the job of build tools, other languages will have to be able to
store this data anyway, ideally in a format that other build tools
understand.
If we can store this information in annotations on the module
descriptor, hopefully Maven, Gradle or other module systems can use it,
rather than what we have ATM which is that we also generate module
descriptors in as many formats as possible (JBoss Modules, OSGi, Maven)
just to store the same info.
And again, this allows these build tools to build the module even in the
absence of a build descriptor. So for instance if you want to build it
with Gradle and you have a simple module (I'm obviously not talking
about complex aspects of the build, but just compiling a module to get a
jar, which only downloads dependencies and sets up the classpath) it
will Just Work without you having to write a build file.
Hell, if javac knew how to resolve dependencies you wouldn't even need a
build tool to build most jars. But I understand that's out of scope.
More information about the jpms-spec-observers
mailing list