javamavenpom.xmljfoenix

Adding JVM Option to maven javafx project


I'm using IntelliJ Idea, and trying to create an executable or jar of my app but I'm having issue with JFornix

This is how I run the application from the IDE

enter image description here

but running this from an executable or jar file returns the

 module java.base does not "opens java.lang.reflect" to module com.jfoenix

I tried adding the args this way

<plugin>
   <groupId>org.openjfx</groupId>
   <artifactId>javafx-maven-plugin</artifactId>
   <version>0.0.6</version>
   <executions>
      <execution>
         <!-- Default configuration for running with: mvn clean javafx:run -->
         <id>default-cli</id>
         <configuration>
            <mainClass>com.ahs.pos/com.ahs.pos.Launcher</mainClass>
            <arg>--add-opens=java.base/java.lang.reflect=com.jfoenix</arg>
         </configuration>
      </execution>
   </executions>
</plugin>

it's a similar issue to this post but with gradle, and I'm trying to do this on maven pom.xml

any ideas how I should go about doing this?


Solution

  • Referring to the documentation, the argument should be using <option> instead

    <plugin>
       <groupId>org.openjfx</groupId>
       <artifactId>javafx-maven-plugin</artifactId>
       <version>0.0.6</version>
       <executions>
          <execution>
             <!-- Default configuration for running with: mvn clean javafx:run -->
             <id>default-cli</id>
             <configuration>
                <mainClass>com.ahs.pos/com.ahs.pos.Launcher</mainClass>
                <options>
                    <option>--add-opens</option>
                    <option>java.base/java.lang.reflect=com.jfoenix</option>
                </options>
             </configuration>
          </execution>
       </executions>
    </plugin>