gpt4 book ai didi

spring-boot - gradle build --warning-mode =不建议使用的所有警告注释处理器而是使用处理器路径

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

当我执行gradle clean build --warning-mode=all时,收到以下警告:

Putting annotation processors on the compile classpath has been deprecated and is scheduled to be removed in Gradle 5.0. Please add them to the processor path instead. If these processors were unintentionally leaked on the compile classpath, use the -proc:none compiler option to ignore them..

build.gradle
buildscript {
ext {
springBootVersion = '1.5.10.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}

}
apply plugin: 'war'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
repositories {
mavenCentral()
}


dependencies {
compile "org.springframework.boot:spring-boot-starter-web"
compile "org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.1"
compile files("libs/ojdbc7.jar")
compile "org.springframework.boot:spring-boot-configuration-processor"
compile group: "javax.inject", name: "javax.inject", version: "1"
runtime "org.springframework.boot:spring-boot-devtools"
providedRuntime "org.springframework.boot:spring-boot-starter-tomcat"
testCompile "org.springframework.boot:spring-boot-starter-test"
}
bootRepackage {
enabled = false
}

我不明白警告是关于什么的。我是Gradle的新手。我需要帮助来了解我应该使用的 annotation processors和如何使用 processor path

最佳答案

什么是annotation processors?

Annotation processors are Java modules/libraries that act as a hook into the compile process of the java compiler, to analyze the source code for user-defined annotations and handle then (by producing compiler errors, compiler warning, emitting source code, bytecode ...).



我应该如何使用它?

One of your compile dependencies must be bringing the annotation processors behind the scenes.



如何改为使用处理器路径?

As per Gradle documentation, you can add annotation processor configuration like below


dependencies {
annotationProcessor 'com.google.dagger:dagger-compiler:2.8'
implementation 'com.google.dagger:dagger:2.8'
}

或者,您可以按照此 guideline-proc:none放在编译器参数中以将其忽略

关于spring-boot - gradle build --warning-mode =不建议使用的所有警告注释处理器而是使用处理器路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49440646/

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