在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):tbroyer/gradle-errorprone-plugin-v0.0.x开源软件地址(OpenSource Url):https://github.com/tbroyer/gradle-errorprone-plugin-v0.0.x开源编程语言(OpenSource Language):Java 49.9%开源软件介绍(OpenSource Introduction):Gradle error-prone plugin v0.0.xhttps://github.com/tbroyer/gradle-errorprone-pluginThis repository contains the implementation for versions 0.0.x of the plugin, new development (starting with version 0.6) happens inThis plugin configures RequirementsThis plugin depends on Gradle internal APIs, and is only guaranteed to work with the Gradle version it's been tested against. It also depends on Javac internal APIs, directly exposed by error-prone.
¹: error-prone 1.x is only supported with JDK 7 Note: Gradle 2.0 is not supported; it lacks APIs to manipulate the actual compiler being used. Similarly, Gradle 3.5-rc-1 removed APIs this plugin uses, they've been reintroduced in 3.5-rc-2. UsageTo use the error-prone plugin,
first add it to your project following the instructions from the Gradle Plugin Portal¹,
then make sure you have a repositories {
mavenCentral()
} ¹: For older versions of the plugins, please read the according version of this README When applied, the You can configure the error-prone compiler using the tasks.withType(JavaCompile) {
// In Gradle 4.9+, prefer using tasks.withType(JavaCompile).configureEach {
options.compilerArgs += [ '-Xep:DeadException:WARN', '-Xep:GuardedByValidator:OFF' ]
} The plugin adds an dependencies {
errorprone 'com.google.errorprone:error_prone_core:2.3.1'
} or, for versions of the plugin before (and including) 0.0.8:configurations.errorprone {
// 2.0.5 is the last version compatible with JDK 7
resolutionStrategy.force 'com.google.errorprone:error_prone_core:2.0.5'
} WARNING: Using a dynamic or changing version for Error Prone,
such as the default configuration using If you forked error-prone and changed the dependencies {
// Use my.company fork of error-prone
errorprone "my.company.errorprone:error_prone_core:latest.release"
} or, for versions of the plugin before (and including) 0.0.8:// Use my.company fork of error-prone
configurations.errorprone {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'com.google.errorprone') {
details.useTarget "my.company.errorprone:${details.requested.name}:latest.release"
}
}
} Advanced usageIf you want more control as to which task to change,
you can apply the import net.ltgt.gradle.errorprone.ErrorProneToolChain
compileJava {
toolChain ErrorProneToolChain.create(project)
inputs.files(configurations.errorprone).withNormalizer(ClasspathNormalizer)
// With Gradle < 4.3, use:
// inputs.files(configurations.errorprone)
} You can go further and provide a import net.ltgt.gradle.errorprone.ErrorProneToolChain
compileJava {
toolChain new ErrorProneToolChain(configurations.errorprone)
inputs.files(configurations.errorprone).withNormalizer(ClasspathNormalizer)
// With Gradle < 4.3, use:
// inputs.files(configurations.errorprone)
} TroubleshootingIf your build fails with a compiler error, before opening an issue here, first make sure you're not suffering from a dependency misconfiguration, or hitting an Error Prone bug. Dependency configuration issueRun This could be the case if you're using the Spring Dependency management plugin, or the Nebula Resolution Rules Plugin, Nebula Dependency Recommender, or Nebula Blacklist Plugin. Error Prone bug
If those steps reproduce the issue, then it's an ErrorProne bug (in which case please report the issue to the Error Prone project); otherwise it might be a gradle-errorprone-plugin bug (and then I'd need a repro case to debug what's happening). You can also try using different versions of Error Prone. If that fixes your problem, then again it likely is not a gradle-errorprone-plugin bug. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论