I have a spring-boot project with the following build.gradle:
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
}
When I executed build gradle, I received this error:
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.
My jdk version is 17 and my gradle version is 8.0.2
I tried to upgrade gradle to the latest version 8.2.1. But it didn't work.
Property baseName
has been deprecated from gradle version 5, and has been removed from latest versions : https://docs.gradle.org/5.2.1/dsl/org.gradle.api.tasks.bundling.Jar.html#org.gradle.api.tasks.bundling.Jar:baseName
please check API documentation and choose the correct property depending on what you need: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html