參考配置java
apply plugin: "idea" apply plugin: "groovy" apply plugin: "eclipse" apply plugin: "application" dependencies { compile localGroovy() } task sourcesJar(type: Jar, dependsOn: classes) { classifier = 'sources' from sourceSets.main.allSource } jar { manifest { attributes "Main-Class":"com.dalong.Application" } } task javadocJar(type: Jar, dependsOn: javadoc) { classifier = 'javadoc' from javadoc.destinationDir } artifacts { archives sourcesJar archives javadocJar } mainClassName = "com.dalong.Application"