group 'cn.com.agree' version '1.0-SNAPSHOT' apply plugin: 'java' compileJava.options.encoding = 'UTF-8' sourceCompatibility = 1.8 repositories { maven { url 'https://repo.maven.apache.org/maven2/' } } task fatJar(type: Jar) { manifest{ attributes "Manifest-Version": "1.0", "Main-Class": "cn.com.agree.MainWindow" } var baseName = project.name + '-all' from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it).matching { exclude { it.path.contains('META-INF') } } } } with jar } def isWindows() { return System.properties['os.name'].contains('Windows'); } dependencies { if(isWindows()){ implementation (fileTree('os/windows'){include '*.jar'}) }else{ implementation (fileTree('os/linux'){include '*.jar'}) } implementation (fileTree('libs'){include '*.jar'}) implementation 'org.apache.poi:poi:3.15' implementation 'org.apache.poi:poi-ooxml:3.15' implementation 'org.simplejavamail:simple-java-mail:4.1.2' implementation 'com.alibaba:fastjson:1.1.50.android' }