Finally found a solution (mainly taken from http://apache-geronimo.328035.n3.nabble.com/Maven-compiler-endorsed-libraries-tp693448p702566.html):
- The java compiler has an option "endorseddirs" to overwrite the bootstrap classes
- If you place the plugin.jar inside one of these folders it overwrites the JSObject from JavaFX
- In your maven poms you have to tell the compiler plugin which folders to search and you can use the dependency plugin to copy dependencies/artifacts to that folders
Compiler plugin:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArguments>
<endorseddirs>${project.build.directory}/endorsed</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
(If you have the plugin.jar as a maven dependency:)
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-endorsed-dependencies</id>
<phase>generate-sources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeArtifactIds>plugin</includeArtifactIds>
<outputDirectory>${project.build.directory}/endorsed</outputDirectory>
</configuration>
</execution>
...
</plugin>