I'm building my project with maven and java-9. I've added in my pom.xml file:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<compilerArgs>
<arg>--add-modules</arg>
<arg>java.xml.bind</arg>
</compilerArgs>
</configuration>
</plugin>
But still, to run the application I have to run it like this:
java -jar --add-modules java.xml.bind my-app.jar
Is there a way to build the application, to run from the command line without --add-modules java.xml.bind to java command line arguments?
maven-compiler-pluginis just for compilerjavacwhich is also used by maven to compile your project, but not for runtimejava, so you had to add--add-modulesto java runtimejava. - Tiina--add-modules. - wbk