build.gradle 中的属性基本名称未知

问题描述 投票:0回答:1

我有一个带有以下 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。但没有成功。

java spring-boot gradle jar
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.