Hi,
I'm working on a Vert.X project with latest release (3.9.2) and using a JDK 11 (open 11.0.7). I made some attempts to build a lighter Docker image (using Jlink to build a custom JRE).
Moving to JDK 8 to 11 OK. But once I add a module-info.java file like this (minimal version here, jlink may require some other dependencies later on but it's enough to get the bug):
module service.proxy.howto {
requires vertx.codegen;
requires vertx.service.proxy;
requires vertx.core;
requires vertx.web.client;
}
And after I added the maven compiler plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<annotationProcessorPaths>
<annotationProcessorPath>
<groupId>io.vertx</groupId>
<artifactId>vertx-codegen</artifactId>
<version>${vertx.version}</version>
<classifier>processor</classifier>
</annotationProcessorPath>
<annotationProcessorPath>
<groupId>io.vertx</groupId>
<artifactId>vertx-service-proxy</artifactId>
<version>${vertx.version}</version>
<classifier>processor</classifier>
</annotationProcessorPath>
</annotationProcessorPaths>
</configuration>
</plugin>
Then, I cannot compile my project because of a NPE. Using Maven -X option, I see:
Caused by: java.lang.NullPointerException
at com.sun.tools.javac.code.Symbol.packge (Symbol.java:497)
at com.sun.tools.javac.model.JavacElements.getPackageOf (JavacElements.java:439)
at io.vertx.codegen.CodeGen.lambda$new$0 (CodeGen.java:60)
I've tried with 3.9.0, 3.9.1 and 3.9.2, same issue. With 5th milestone from Vert.X 4, this is the CodeGenProcessor class that throws a NPE.
I previously made some attemps too with the moditect plugin (that allows to kinf od "modularize" non "modularized" jar) but last versions of Vert.X does not work (last working version is 3.8.0, 3.8.1 updated to Netty 4.1.36.Final and it just crash:
https://github.com/moditect/moditect/issues/57).
More generally, I'd like to know what is the "official" way of doing with Vert.X to produce lighter Docker images with JDK 11+ ?
Base images are awfully big and even a 20 MB application jar may results in a 280 MB Docker image (><).
I managed to have something better by using modules (more something like 80 MB) but then the code generator issue I mentioned earlier happened.
From now on, I think I'm going to give a try by providing an automatic module (it's a bit weird but if it works....)
If someone has a better idea or already encountered the same issues, I'm all ears.
Regards,
Jérémy Florte