Gradle- no main manifest attribute

前端 未结 3 660
遥遥无期
遥遥无期 2020-11-30 00:03

I\'m kind of going crazy with this error I get when running a JAR file built off Gradle. The error reads \"no main manifest attribute, in RxJavaDemo.jar\" I tried manipulat

3条回答
  •  旧时难觅i
    2020-11-30 00:50

    Try to change your manifest attributes like:

    jar {
      manifest {
        attributes(
          'Class-Path': configurations.compile.collect { it.getName() }.join(' '),
          'Main-Class': 'hello.HelloWorld'
        )
      }
    }
    

    And then just change 'hello.helloWorld' to '.' (where your Main class has a main method). In this case, you make in your manifest an attribute, which point to this class, then a jar is running.

提交回复
热议问题