How to set the main class classpath for JavaExec task in Gradle?
<p>I got that if I want to run a main from a Main class, by using the <code>sourceSets.main.runtimeClasspath</code> classpath, I have to put the Main class inside of <code>src/main/java</code> and use something like:</p>

<pre><code>apply plugin: 'java'

dependencies {

}

task myTask (type: JavaExec){
    dependsOn classes
    classpath sourceSets.main.runtimeClasspath
    main = 'Main'
}
</code></pre>

<p>What I want is understand how I can specify a different classpath from which to retrieve the class containing the main(). 
What if I want to run the main from a class which is not in src/main/java but it is in the same folder as the <code>build.gradle</code>?</p>

<p>I'm aware that it has no sense to do something like that, but I wish to find a solution <strong>as an exercise</strong> to learn Gradle.</p>