I used the Intellij JavaFX generator to create a JavaFx application with Java17 and Maven. The javafx-maven-plugin
specifies a main class and I can run the app from this main class. But I also want to run the app from a test class. If I try that I get this error:
Error: JavaFX runtime components are missing, and are required to run this application
Originally I built the app with Java8 and JavaFX. With Java8 I could run the app from the main class as well as the test class. Simply converting the project to Java17 didn't work so I had Intellij generate a new project and copied the old source into the new project. With Java17 I can run the app from the main class but not from the test class.
How can I run the app from the test class in the new project? Thanks in advance!
Edit:
An excerpt from the pom as generated by Intellij:
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
<executions>
<execution>
<!-- Default configuration for running with: mvn clean javafx:run -->
<id>default-cli</id>
<configuration>
<mainClass>io.wouter.gmsbooks.offerapp/io.wouter.gmsbooks.GmsOfferApp</mainClass>
<launcher>app</launcher>
<jlinkZipName>app</jlinkZipName>
<jlinkImageName>app</jlinkImageName>
<noManPages>true</noManPages>
<stripDebug>true</stripDebug>
<noHeaderFiles>true</noHeaderFiles>
</configuration>
</execution>
</executions>
</plugin>
The javafx-maven-plugin
only mentions a main class, no test class. Or should I add another execution
referring to the test class?