ModuleMainClass attribute via module-info.java

Jendrik Johannes jendrik at gradle.com
Mon Jun 8 09:02:01 UTC 2020


Hi,

Just wanted to mention for anyone ending up here as it is related:
In Gradle's Java Module support (since Gradle 6.5) we faced the same issue
as it fits the input/output model of Gradle tasks better if the
*compileJava* task does all the class file creation/modification. So in
Gradle it is possible to set the ModuleMainClass attribute on the
compileJava task. It is implemented by rewriting the module-info.class with
ASM right after it was created by the Java compiler.

https://docs.gradle.org/current/userguide/application_plugin.html#sec:application_modular

Cheers
Jendrik

On Fri, Jun 5, 2020 at 10:33 PM Gunnar Morling <gunnar at hibernate.org> wrote:

> Hey Florian,
>
> not javac, but ModiTect allows you to specify the main class when
> defining module descriptors:
>
>
> https://github.com/moditect/moditect#adding-a-module-descriptor-to-the-project-jar
>
> --Gunnar
>
> Am So., 31. Mai 2020 um 19:32 Uhr schrieb Florian Weimer <fw at deneb.enyo.de
> >:
> >
> > Is it possible to instruct javac to generate a ModuleMainClass
> > attribute via a module declaration?  I can't find the appropriate
> > syntax in the JLS.  If there is no way to get javac to generate the
> > attribute, what is the reason for that?
>


-- 

[image: Email-Signature at 2x.png]

Jendrik Johannes

Senior Software Engineer

Gradle

W. gradle.com


More information about the jigsaw-dev mailing list