With compilation working what I was experimenting with is not as important, but for the record here is the idea:
- Get a WAR file with the plugin(s) you want to test (custom-war-packager might be helpful) based on a version of Jenkins core with Java 10 fixes (i.e. The java10-support branch).
- Create a Java properties file named java10.properties with the following content (can add extra maven arguments as needed)
jvm = $JAVA10_HOME/bin/java
argLine = --add-modules java.xml.bind"
- Run the PCT using that WAR file passing the argument -mavenPropertiesFile=java10.properties to the PCT.
The effect is that the Java 10 JVM will be used to run tests, while the default version of Java on the machine (presumably Java 8) will be used for compilation. This could be made more robust by preparing Docker images based on maven-jdk8 images with Java 10 installed but not set as the default, and then using the runPCT step on ci.jenkins.io with that image.
You could also pass those options to a standard Maven build, but you will also have to override the version of Jenkins being used. To me it seemed that the most likely case for Java 10 testing if compilation wasn't working was to do bulk testing of many plugins at once, which is why I experimented with the PCT.