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-plugin
is just for compilerjavac
which is also used by maven to compile your project, but not for runtimejava
, so you had to add--add-modules
to java runtimejava
. – Obsidian--add-modules
. – Pedlar