To keep the example simple, I’m going to use Jenkins Pipeline’s dockerfile agent . It executes given pipeline stage (or stages) in a docker container that gets started from a docker image created using local Dockerfile.

The Jenkins Pipeline contains two stages - Build, and Install. The Build stage has two parallel stages inside. The first one compiles the Maven project using OpenJDK 8, while the second one uses OpenJDK 11. Keep in mind that this is just an illustration. You could use the same approach to compile your project using e.g., two different Maven versions, or different JDK vendors.