I'm working on an applet that uses JSObject & co. (from plugin.jar) to invoke JavaScript functions on the web page where it's loaded; the project is built using pure mvn: no IDEs, no Jenkins.
My problem arises from the fact that Oracle provides two classes with the exact same FQ name and different method signatures (see JSObject#getWindow()). After upgrading the local JDK to Java8 the build fails on JSObject because it ends up picking it from JavaFX (jfxrt.jar) instead of plugin.jar (alphabetical ordering in classpath?).
I have been looking for a solution here and elsewehere and what I came across is:
- explicitly reorder the dependencies in your IDE (but I have no IDE...)
- use maven dependencies ordering in the POM (supported since 2.0.X and I'm running on 3.3.9, yet this seems to work for project dependencies, not system JARs)
- use exclusions (does not seem to apply to JDK dependencies either)
- on Jenkins things seem to be automagically resolved thanks to Jenkins adding the JDK JARs to the build classpath after the project dependencies.
So the question is: is there a way to configure a maven project building against JDK8 so it consistently resolves JSObject from plugin.jar instead of jfxrt.jar on all platforms (Windows, *nix etc.)?