Use different java for the submodules

i have one main module which has two sub modules. The problem is that one of them is using java 1.8 and the other one is using java 1.7. How can i do it ? How can i add Gradle JVM to be per sub module ?
I am using gradle 4.10.2


Assuming this is the same as this StackOverflow question, let’s keep the discussion there.

Please do not open multiple conversations on the same topic in the future, this only makes it harder to give you a good answer.