Error maven using tools with scripted pipeline

Hello ,

We update Jenkins from the version Jenkins 2.375.2 to 2.472.

When we are trying using your existing pipeline we have this error.

Exception in thread “main” java.lang.NoSuchMethodError: getMainType

This error comes when trying running the command “mvn clean install”. We configure the Tools with maven and the jdk. And we are using the command tools with maven and jdk in pipeline script like that :

pipeline {
    agent any
    tools {
        maven "maven-3.8.3"
        jdk "JAVA-11"
    }

In the previous version worked fine. Doing so research i created several jobs of tests and seems that the PATH variable dont have the JAVA_HOME and MAVEN_HOME path . Anyone know how the tools in pipeline do that ?