Reputation: 42229
I currently have the following gradle to run an application
apply plugin: 'application'
application {
mainClassName = 'com.Example'
}
This doesn't work as the Example class is in the test module as it's not meant to be released in production code. Is there any way to specify to gradle to look in the test module, instead of the main module?
Upvotes: 0
Views: 115
Reputation: 42229
Solution was to not use the application
module; instead...
apply plugin: 'java'
task runExample(type: JavaExec) {
classpath = sourceSets.test.runtimeClasspath
main = 'com.Example'
}
Upvotes: 1