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
  • 相关阅读:
    DMZ区
    集群(cluster)和高可用性(HA)的概念
    JS禁用右键,禁用打印,防止另存为,IE浏览器识别(转载)
    window.open实现模式窗口(只弹出一个window.open)
    Textarea自适应高度 JS实现,兼容IE67891011
    JQ基础语法
    SQL 小笔记
    CSS样式笔记
    IE8下 Select文字垂直居中的办法
    汉字转全拼音函数优化方案(SQLServer),值得你看看
  • 原文地址:https://www.cnblogs.com/devilwind/p/8651125.html
Copyright © 2011-2022 走看看