将Gradle配置迁移到Gradle 8.2

x4shl7ld  于 2023-11-18  发布在  其他
关注(0)|答案(1)|浏览(174)

我有以下Gradle配置:

plugins {
    id 'org.springframework.boot' version '2.6.15'
    id 'io.spring.dependency-management' version '1.1.0'
    id 'java'
}

group = 'com.test'
version = '0.0.1'

java {
    sourceCompatibility = '17'
}

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

ext {
    set('springCloudVersion', "2021.0.8")
}

repositories {
    mavenCentral()
    maven {
        url "http://192.168.1.111/repository"
        allowInsecureProtocol = true
    }
}

configurations {

    configureEach {
        exclude group: 'org.springframework.boot', module: 'spring-boot-starter-web'
    }
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-actuator'
    implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap'
    annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
    testImplementation 'org.junit.jupiter:junit-jupiter-api'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
}

dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
    }
    resolutionStrategy {
        cacheDynamicVersionsFor 0, "seconds"
        cacheChangingModulesFor 0, "seconds"
    }
}

tasks.named('test') {
    useJUnitPlatform()
}

字符串
在编译过程中,我得到:

The Project.getConvention() method has been deprecated. This is scheduled to be removed in Gradle 9.0. Consult the upgrading guide for further information: https://docs.gradle.org/8.2/userguide/upgrading_version_8.html#deprecated_access_to_conventions
The org.gradle.api.plugins.Convention type has been deprecated. This is scheduled to be removed in Gradle 9.0. Consult the upgrading guide for further information: https://docs.gradle.org/8.2/userguide/upgrading_version_8.html#deprecated_access_to_conventions
The org.gradle.api.plugins.JavaPluginConvention type has been deprecated. This is scheduled to be removed in Gradle 9.0. Consult the upgrading guide for further information: https://docs.gradle.org/8.2/userguide/upgrading_version_8.html#java_convention_deprecation


您知道如何正确迁移此配置吗?

8fq7wneg

8fq7wneg1#

我已经在我的项目中解决了这个问题,

java {
    sourceCompatibility = '17'
}

字符串

java {
    sourceCompatibility = JavaVersion.VERSION_17
}

相关问题