Thanks for the answer. I have already done everything exactly like this. I only had a problem with ForgeGradle plugin version 1.2, which refused to work on gradle versions older than 4.0.
However, the issue has already been resolved by replacing ForgeGradle 1.2 with a fork by anatawa12. However, I had to install version 5.0 in the gradle wrapper, the fork does not work with the version below.