gradle发布jar包
在.gradle文件中添加以下代码
apply plugin: 'application'
mainClassName = 'com.excel.ExcelApplication'
jar {
    doFirst {
        def jarFiles = '';
        configurations.compile.collect {
            jarFiles += it.name + " "
        }
        manifest {
            attributes(
                    "Manifest-Version": "1.0",
                    "Class-Path": jarFiles,
                    "Main-Class": "com.excel.ExcelApplication")
        }
    }
}
task deploy(type: Copy) {
    doFirst {
        println "cmd /c gradle clean".execute().text
        println "cmd /c gradle build -x test".execute().text
    }
    from configurations.runtime
    into "excelJar"
    from "build/libs/execl-1.0-SNAPSHOT.jar"
    into "excelJar"
}
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
 
                    
                     
                    
                 
                    
                 
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号