在build里加入以下配置(如果不是一个可执行的jar包的话就不用配置Main-Class属性):

def mainClassName = "你需要执行的main方法所在的的包名+类名"
jar {
    manifest {
        attributes "Main-Class": "$mainClassName"
    }

    from {
        configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
    }
}

 

然后运行jar任务打包jar文件就可以了

相关文章:

  • 2021-05-15
  • 2022-12-23
  • 2021-08-15
  • 2021-08-23
  • 2021-07-26
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-21
  • 2022-02-26
  • 2021-07-24
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案