Closed baev closed 5 years ago
+1
I can't do anything with it, sorry. We can only wait for an official fix (return of the reverted pmd dsl extension).
PS don't know why but I'm getting hundreds of lines with such warning per module
This is odd: you should see only one message per module. Can't imagine any case when this could happen. If you have some simple project with such behaviour please share with me and I will look.
If you have some simple project with such behaviour please share with me and I will look.
Thank you for the sample project! The issue indeed exists, but it's again related to pmd.. almost :)
By default, when we have single source dir (src/main/java) it's passed as dir to pmd ant task and so we see just one warning. If we add another directory (like generated dir in your case) then gradle will set sources into ant task as separate files. Now the interesting part, pmd ant task is called just once, but internally it runs pmd for each source file and, of course, show the warning each time.
I could look to regroup FileTree (to make conversion from gradle FileTree into ant FileSet smarter), but it will become completely useless as soon as gradle introduce new pmd flag and hide warnings... so I think it's better to simply wait for a new flag
@xvik so adding an addtionalArguments
or similar property to allow me to pass arbitrary command line arguments to PMD is not an option? This is a familiar pattern that many tools use when wrapping other tools, precisely to allow users flexibility to deal with mismatches between the two tools.
@eatdrinksleepcode If it was my implementation (like animalsniffer plugin) I would already fix that. But I'm using gradle's pmd plugin and there is simply no way to modify ant task call. All we have is an official extension for pmd plugin configuration and so we have to wait when gradle team add new option there.
+1
It looks like the latest Gradle release (5.6) has support for PMD incremental analysis now. Is this possible to fix now?
https://docs.gradle.org/current/release-notes.html#support-for-pmd-incremental-analysis
Great, thank you! That means that everyone could remove this warning even now by applying pmd configuration directly.
In the next version, I will mirror this configuration as quality.enablePmdIncrementalAnalysis
(or something like this) to simplify configuration.
I don't think that this option should be enabled by default. I assume there might be issues with gradle's own incremental compilation (which was the reson why initial support was rolled back). But if anyone could assure that it is safe to enable it by default please tell me.
Finally have time to look at it. The original issue (pmd warnings) was completely solved by new pmd plugin version: gradle now applies explicit -nocache parameter when incremental compilation is not enabled and so warning should never appear anymore (no matter if incremental support enabled or not).
As promised, I only added new pmd configuration shortcut in quality closure:
quality {
pmdIncremental = true
}
Disabled by default.
Pmd has an option
-no-cache
that disables build cache, but as far as I know there is no way to specify it viagradle-pmd-plugin
as well as no way to configure cache dir.Related issues: https://github.com/gradle/gradle/issues/2862 https://github.com/gradle/gradle/pull/3125
PS don't know why but I'm getting hundreds of lines with such warning per module