buildscript { ext.kotlinVersion = '1.3.50' repositories { mavenLocal() jcenter() } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" } } allprojects { apply plugin: 'java' apply plugin: 'kotlin' group 'cn.tursom' version '0.1' sourceCompatibility = 1.8 repositories { mavenLocal() mavenCentral() } dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion" testCompile group: 'junit', name: 'junit', version: '4.12' } compileKotlin { kotlinOptions.jvmTarget = "1.8" } compileTestKotlin { kotlinOptions.jvmTarget = "1.8" } //打包源代码 task sourcesJar(type: Jar, dependsOn: classes) { //classifier = 'sources' archiveClassifier.set('sources') from sourceSets.main.allSource } artifacts { archives sourcesJar } }