plugins {
id 'org.jetbrains.kotlin.jvm' version '1.8.21'
}
group = 'org.example'
version = '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
testImplementation 'org.jetbrains.kotlin:kotlin-test'
}
test {
useJUnitPlatform()
}
kotlin {
jvmToolchain(8)
}
jar {
manifest {
attributes 'Main-Class': 'Main'
attributes 'Class-Path': ''
}
// 解决报 module-info.class 重复但是没有指定重复策略的问题,因为默认值为 DuplicatesStrategy.INHERIT
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
from {
configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
}
class Main {
companion object {
@JvmStatic
fun main(args: Array<String>) {
run()
}
}
}
网友评论