For declarative pipelines, the tools can be selected on a job-basis, in the tools section, https://jenkins.io/doc/book/pipeline/syntax/#tools:
jdk 'Oracle-JDK8-64bit' <-- JDK
maven 'apache-maven-3.x' <-- maven
But there are some nice features for the withMaven as well (such as flags for reports, setting the maven repo location). It would be nice if withMaven could use what has been declared in the tools section, so it need not be redefined for each maven execution.
11:43:50 [withMaven] Options: [org.jenkinsci.plugins.pipeline.maven.publishers.JunitTestsPublisher[disabled=false]]
11:43:50 [withMaven] Available options:
11:43:50 [withMaven] use JDK installation provided by the build agent <-- pick up from tools section
11:43:50 [withMaven] use Maven installation 'apache-maven-3.5.x' <-- pick up from tools section