plugins { id 'java' id 'application' id 'com.github.johnrengelman.shadow' version '7.1.2' id 'edu.sc.seis.launch4j' version '2.5.4' } def requiredJavaVersion = 20 def currentJavaVersion = JavaVersion.current().majorVersion.toInteger() if (currentJavaVersion != requiredJavaVersion) { throw new GradleException("构建需要 JDK ${requiredJavaVersion},但当前是 JDK ${currentJavaVersion}。请更换 JDK 环境。") } group = 'com.axis.innovators.box' version = '1.0-SNAPSHOT' repositories { mavenLocal() maven { url "https://maven.aliyun.com/repository/public" } mavenCentral() jcenter() } dependencies { testImplementation platform('org.junit:junit-bom:5.10.0') testImplementation 'org.junit.jupiter:junit-jupiter' } application { mainClass = 'com.axis.innovators.box.Main' } shadowJar { archiveBaseName = 'app' archiveClassifier = '' archiveVersion = '' } launch4j { mainClassName = 'com.axis.innovators.box.Main' outfile = version + '.exe' icon = "${projectDir}/logo.ico" jar = shadowJar.archiveFile.get() bundledJrePath = 'jre' } tasks.named('launch4j') { dependsOn shadowJar } test { useJUnitPlatform() }