我有一个带有以下 build.gradle 的 spring-boot 项目:
plugins {
id 'java'
}
group 'regular-ghost-player'
version ''
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
testImplementation group: 'junit', name: 'junit', version: '4.12'
}
task createJar(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Ghost Project',
'Implementation-Version': version,
'Main-Class': 'myCode.GhostSkeleton'
}
baseName = 'winnerBot' //Replace 'your_team_name' with your actual team name. No spaces allowed!
destinationDirectory.set(file("$projectDir/"))
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
当我执行 build gradle 时,我收到此错误:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\kongz\OneDrive\Desktop\BHCC-CS\2023SU CSC-239\wk9\regular-ghost-player\build.gradle' line: 24
* What went wrong:
A problem occurred evaluating root project 'regular-ghost-player'.
> Could not set unknown property 'baseName' for task ':createJar' of type org.gradle.api.tasks.bundling.Jar.
我的jdk版本是17,我的gradle版本是8.0.2
我尝试将gradle升级到最新版本8.2.1。但没有成功。
属性
baseName
已从 gradle 版本 5 中弃用,并已从最新版本中删除:https://docs.gradle.org/5.2.1/dsl/org.gradle.api.tasks.bundling.Jar。 html#org.gradle.api.tasks.bundling.Jar:baseName
请检查 API 文档并根据您的需要选择正确的属性:https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html