zoukankan      html  css  js  c++  java
  • 用gradle打包可运行jar

    参考了

    http://www.cnblogs.com/yongtao/p/4104526.html

    gradle文件加入

    apply plugin: 'application'
    mainClassName = 'com.xxx.Xxx'
    //打包 task runnbaleJar(type: Jar) { from files(sourceSets.main.output.classesDir) from configurations.runtime.asFileTree.files.collect { zipTree(it) } manifest { attributes 'Main-Class':'com.Sayer' } }


    作者:bsqql123
    链接:https://www.jianshu.com/p/4d5c82d80041
    來源:简书
    著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
    
    
    //打包 task runnbaleJar(type: Jar) { from files(sourceSets.main.output.classesDir) from configurations.runtime.asFileTree.files.collect { zipTree(it) } manifest { attributes 'Main-Class':'com.Sayer' } }//打包 task runnbaleJar(type: Jar) { from files(sourceSets.main.output.classesDir) from configurations.runtime.asFileTree.files.collect { zipTree(it) } manifest { attributes 'Main-Class':'com.Sayer' } }


    作者:bsqql123
    链接:https://www.jianshu.com/p/4d5c82d80041
    來源:简书
    著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
    task runnbaleJar(type: Jar) { 
    from files(sourceSets.main.output.classesDir)
    from configurations.runtime.asFileTree.files.collect { zipTree(it) }
    manifest { attributes 'Main-Class':'com.xxx.Xxx' }

       exclude('LICENSE.txt', 'NOTICE.txt', 'rootdoc.txt')  

       exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'  

       exclude 'META-INF/NOTICE', 'META-INF/NOTICE.txt'  

       exclude 'META-INF/LICENSE', 'META-INF/LICENSE.txt'  

       exclude 'META-INF/DEPENDENCIES' 


    }

    exclude 这些必须加上,不然打包出来的jar 无法运行,会报invalid signature file degist for manifest
    在另外一篇用maven打包的也提及过此问题 https://www.cnblogs.com/fuxinci/p/3356087.html
  • 相关阅读:
    Django报错 No module named 'django.templates'
    Django 创建 hello world
    python(Django2.0) 安装
    create-react-app踩坑记
    Vue项目的痛点
    React 错误处理(componentDidCatch)
    Vue props双向绑定
    redux 中的 redux-thunk(中间件)
    webpack 搭建React(手动搭建)
    vue interceptors(拦截器)
  • 原文地址:https://www.cnblogs.com/devilwind/p/8651125.html
Copyright © 2011-2022 走看看