Just build a jar and specify the main class in the command as shown in your example.
The jar main class can be only one and it is being used when you specify java -jar (not java -cp). BTW this is not a Gradle question - this is how Java works.
Yes This is a gradle question. I am not asking which command we need to run a jar. And also we can have multiple main classes inside a single jar. All I asked is how to build that jar with multiple main classes.