Gradle - Could not find or load main class

前端 未结 13 819
星月不相逢
星月不相逢 2020-11-29 06:51

I\'m trying to run a very simple project using Gradle and running into the following error when using the gradlew run command:

could not find or l

13条回答
  •  渐次进展
    2020-11-29 07:37

    I see two problems here, one with sourceSet another with mainClassName.

    1. Either move java source files to src/main/java instead of just src. Or set sourceSet properly by adding the following to build.gradle.

      sourceSets.main.java.srcDirs = ['src']
      
    2. mainClassName should be fully qualified class name, not path.

      mainClassName = "hello.HelloWorld"
      

提交回复
热议问题