code: private static Maven.MavenInstallation getMavenInstallation(MavenModuleSetBuild build, EnvVars vars,
              TaskListener listener) throws IOException, InterruptedException {
          MavenModuleSet project = build.getProject();
          Maven.MavenInstallation mavenInstallation = project.getMaven();
          if (mavenInstallation == null) {
              throw new AbortException("A Maven installation needs to be available for this project to be built.\n" +
                      "Either your server has no Maven installations defined, or the requested Maven version does not exist.");
          }
          return mavenInstallation.forEnvironment(vars).forNode(build.getBuiltOn().toComputer().getNode(), listener);
      }
docs: Get the {@link hudson.model.EnvironmentSpecific} and {@link hudson.slaves.NodeSpecific} Maven installation. First
  get the descriptor from the global Jenkins. Then populate it accordingly from the specific environment node that
  the process is currently running in e.g. the MAVEN_HOME variable may be defined only in the remote node and
  Jenkins is not persisting it as part of its installations.
  
  @param build  The Maven project build that the maven installation is taken from.
  @param vars     The build's environment variables.
  @param listener The build's event listener
  @throws hudson.AbortException If the {@link hudson.tasks.Maven.MavenInstallation} that is taken from the project
  is {@code null} then this exception is thrown.