Could not fetch model of type 'BuildEnvironment' using connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-3.0-bin.zip'. Could not determine Java version using executable C:\Program Files\Java\jdk-18.0.1.1\bin\java.exe

I got this fail when build forge project:Could not fetch model of type ‘BuildEnvironment’ using connection to Gradle distribution ‘https://services.gradle.org/distributions/gradle-3.0-bin.zip’.
Could not determine Java version using executable C:\Program Files\Java\jdk-18.0.1.1\bin\java.exe.
scan

The “scan” you linked to does not match the error you talk about.

The error you posted here most probably is caused by the fact that you are trying to run a Gradle build with Java 18 while there is not yet a Gradle version that supports running on Java 18: Compatibility Matrix
7.5 will add that compatibility.

The scan you posted is pretty meaningful imho, just read the message. It even links you to a concrete manual page.