gpt4 book ai didi

gradle - 如何为io.freefair.lombok设置插件

转载 作者:行者123 更新时间:2023-12-03 05:03:29 24 4
gpt4 key购买 nike

我正在尝试使用io.freefair.lombok插件,但Gradle 4.10.2出现错误。如何设置?

plugins {
id 'org.springframework.boot' version '2.2.5.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id "io.freefair.lombok" version "4.0.0" // error on this line
id 'java'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

repositories {
mavenCentral()
mavenLocal()
}

dependencyManagement {
imports {
mavenBom 'org.springframework.cloud:spring-cloud-dependencies:Hoxton.SR3'
}
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
implementation 'org.springframework.cloud:spring-cloud-starter-openfeign'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
runtimeClasspath 'org.springframework.boot:spring-boot-devtools'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
这是错误:
Could not run build action using Gradle distribution 'https://services.gradle.org/distributions/gradle-4.10.2-bin.zip'.
Build file 'C:\Users\user\eclipse-workspace\car-proj\build.gradle' line: 4
An exception occurred applying plugin request [id: 'io.freefair.lombok', version: '5.0.0-rc4']
Failed to apply plugin [class 'io.freefair.gradle.plugins.lombok.LombokBasePlugin']
Could not generate a proxy class for class io.freefair.gradle.plugins.lombok.LombokExtension.
org/gradle/api/provider/MapProperty
org.gradle.api.provider.MapProperty
添加更多文本,所以发布不是大多数代码

最佳答案

您应用的Lombok插件版本可能与您的Gradle版本不兼容。 project website指出,与Gradle 4.10.2兼容的最新版本是2.x分支,尤其是2.9.5。因此,您可以使用该版本或升级到较新的Gradle版本。
enter image description here
您可能还需要升级Gradle以与Spring Boot Gradle插件保持兼容。

Spring Boot’s Gradle plugin requires Gradle 5.x or 6.x (4.10 is also supported but this support is deprecated and will be removed in a future release).


(来自: Spring Boot Gradle Plugin Reference Guide)
更新
在仔细检查了 build.gradle之后,您已经在 dependencies块中定义了Lombok处理:
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
您可以使用此插件或Lombok插件。无需同时应用两者。

关于gradle - 如何为io.freefair.lombok设置插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63732494/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com