Gab*_*eli 3 java sql gradle jooq java-annotations
Gradle 是否具有与为 JOOQ 类型检查器注释处理器 ( https://www.jooq.org/doc/latest/manual/tools/checker-framework/ )描述的 Maven 配置等效的配置?Maven 版本是:
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq-checker</artifactId>
<version>3.10.5</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
和
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<fork>true</fork>
<annotationProcessors>
<annotationProcessor>org.jooq.checker.SQLDialectChecker</annotationProcessor>
</annotationProcessors>
<compilerArgs>
<arg>-Xbootclasspath/p:1.8</arg>
</compilerArgs>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
但是,虽然我可以将编译依赖项添加到 Gradle 中,但我不确定该放在哪里annotationProcessor。任何帮助将不胜感激!
从 Gradle 3.4 开始,Gradle 通过为处理器添加配置(例如名为“apt”)并设置annotationProcessorPath. 详情请参阅CompileOptions#setAnnotationProcessorPath()。
例子:
configurations {
apt
}
dependencies {
apt 'org.jooq: jooq-checker:3.10.5'
}
tasks.withType(JavaCompile) {
options.annotationProcessorPath = configurations.apt
options.compilerArgs << "-processor" << "org.jooq.checker.SQLDialectChecker"
}
Run Code Online (Sandbox Code Playgroud)
从 Gradle 4.6 开始,使用预定义annotationProcessor配置甚至应该更简单:
dependencies {
annotationProcessor 'org.jooq: jooq-checker:3.10.5'
}
compileJava.options.compilerArgs << "-processor" << "org.jooq.checker.SQLDialectChecker"
Run Code Online (Sandbox Code Playgroud)
另请查看Gradle 4.6-rc.2 发行说明以了解详细信息。当然,总有改进的潜力:使注释处理器成为一等公民。
当然,您可能想查看一些适用于 Gradle 的 jOOQ 插件:https ://plugins.gradle.org/search?term=jooq
| 归档时间: |
|
| 查看次数: |
1502 次 |
| 最近记录: |