Creating Jar with Intellij 2016 - No main manifest attribute

后端 未结 10 1711
清歌不尽
清歌不尽 2021-01-30 16:03

I am getting no main manifest attribute while running the jar create by Intellij. I extracted the jar and observed that there was another manifest

10条回答
  •  北恋
    北恋 (楼主)
    2021-01-30 16:34

    Actually I solved it by adding the following lines in build.gradle

    jar {
        manifest {
            attributes 'Main-Class': 'class name'
        }
        from {
            configurations.compile.collect {
                it.isDirectory()? it: zipTree(it)
            }
        }
    }
    

提交回复
热议问题