Reputation: 170899
Documentation says
In my case the main class is not in the main source set but in jmh
(I wanted to quickly try some things without going through the JMH infrastructure using classes defined there). Can I still use the application plugin?
Simply using ./gradlew :benchmarks:run
gives "could not find or load main class MyMainClass
", as expected. :jmhRun
(by analogy with other tasks) gives "task 'jmhRun' not found in project 'benchmarks'". :runJmh
is the same.
Upvotes: 3
Views: 585
Reputation: 2046
It is still not possible (Gradle 5.0) as the name of the main
source set is not configurable in the org.gradle.api.plugins.ApplicationPlugin#addRunTask
. I've created an issue there https://github.com/gradle/gradle/issues/8113.
UPD: as was suggested in the gradle issue
tasks.named('run', JavaExec) {
classpath = <wanted classpath>
}
Upvotes: 1