When starting Hazelcast in Kotlin, I see the following WARNING message:
WARNING: Hazelcast is starting in a Java modular environment (Java 9 and newer) but without proper access to required Java packages. Use additional Java arguments to provide Hazelcast access to Java internal API. The internal API access is used to get the best performance results. Arguments to be used:
--add-modules java.se --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.management/sun.management=ALL-UNNAMED --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED
I am using the following Maven Kotlin plugin configuration in my pom.xml:
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<configuration>
<jvmTarget>${java.version}</jvmTarget>
</configuration>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
I have tried adding the following configuration to the Kotlin compiler plugin:
<configuration>
<javacOptions>
<arg>--add-modules java.se</arg>
<arg>--add-exports java.base/jdk.internal.ref=ALL-UNNAMED</arg>
<arg>--add-opens java.base/java.lang=ALL-UNNAMED</arg>
<arg>--add-opens java.base/sun.nio.ch=ALL-UNNAMED</arg>
<arg>--add-opens java.management/sun.management=ALL-UNNAMED</arg>
<arg>--add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED</arg>
</javacOptions>
<jvmTarget>${java.version}</jvmTarget>
</configuration>
I tried adding the Java compiler plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<compilerArgs>
<arg>--add-modules java.se</arg>
<arg>--add-exports java.base/jdk.internal.ref=ALL-UNNAMED</arg>
<arg>--add-opens java.base/java.lang=ALL-UNNAMED</arg>
<arg>--add-opens java.base/sun.nio.ch=ALL-UNNAMED</arg>
<arg>--add-opens java.management/sun.management=ALL-UNNAMED</arg>
<arg>--add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED</arg>
</compilerArgs>
</configuration>
</plugin>
I cannot get rid of this warning except explicitly passing these arguments when I run the application. Is it not possible to add these arguments using Maven compiler plugins to avoid having to add them before running the application manually?
I would like that anyone who checks out my project be able to run the application without errors without having to manually add these arguments.