use*_*969 3 gradle lombok gradle-plugin
我正在尝试使用 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'
}
Run Code Online (Sandbox Code Playgroud)
这是错误:
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
Run Code Online (Sandbox Code Playgroud)
添加更多文本,因此帖子主要不是代码
tho*_*est 11
您应用的 Lombok 插件版本可能与您的 Gradle 版本不兼容。该项目网站指出,与 Gradle 兼容的最新版本4.10.2是该2.x分支,具体为2.9.5. 因此,要么使用它,要么升级到更新的 Gradle 版本。
| 插件版本 | 摇篮版本 | Java版本 |
|---|---|---|
| 8.4.x | 8.4 | 8+ |
| 8.3.x | 8.3 | 8+ |
| 8.2.x | 8.2 | 8+ |
| 8.1.x | 8.1 | 8+ |
| 8.0.x | 8.0 | 8+ |
| 6.6.x | 7.6 | 8 - 18 |
| 6.5.x | 7.5 | 8 - 18 |
| 6.4.x | 7.4 | 8 - 17 |
| 6.3.x | 7.3 | 8 - 17 |
| 6.2.x | 7.2 | 8 - 16 |
| 6.1.x | 7.1 | 8 - 16 |
| 6.x | 7.0 | 8 - 16 |
| 5.3.x | 6.7 | 8 - 15 |
| 5.1.x | 6.4+ | 8 - 14 |
| 5.0.x | 6.3 | 8 - 13 |
| 4.x | 5.6+ | 8 - 12 |
| 3.8.x | 5.5.x | 8 - 12 |
| 3.3.x - 3.7.x | 5.4+ | 8 - 12 |
| 3.2.x | 5.3+ | 8 - 11 |
| 3.x | 5.1+ | 8 - 11 |
| 2.x | 4.x | 8 - 11 |
您可能还想升级 Gradle 以保持与 Spring Boot Gradle 插件的兼容性。
\n\n\n\nSpring Boot\xe2\x80\x99s Gradle 插件需要 Gradle 5.x 或 6.x(也支持 4.10,但此支持已弃用,并将在未来版本中删除)。
\n
更新
\n更仔细地检查后build.gradle,您已经在块中定义了 Lombok 处理dependencies:
compileOnly \'org.projectlombok:lombok\'\nannotationProcessor \'org.projectlombok:lombok\'\nRun Code Online (Sandbox Code Playgroud)\n您可以使用这个插件或 Lombok 插件。两者无需同时申请。
\n| 归档时间: |
|
| 查看次数: |
13623 次 |
| 最近记录: |