apply plugin: 'java-library' dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) } jar{ baseName = "ManifestEditor" manifest { attributes 'Main-Class': 'com.wind.meditor.ManifestEditorMain' } //添加将引用的jar的源码打入最终的jar from { (configurations.runtime).collect { it.isDirectory() ? it : zipTree(it) } } from fileTree(dir:'src/main', includes: ['assets/**']) //排除引用的jar中的签名信息 exclude 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/*.MF' } //添加源码中引入的非代码文件,例如资源等 sourceSets.main.resources { srcDirs = [ "src/main/java", ]; include "**/*.*" }