maven-pmd-plugin
maven-pmd-plugin copied to clipboard
Generate pmd.xml, but skip HTML generation
New feature, improvement proposal
I would like an option to keep generating the XML file, but to skip the HTML reports.
The pmd.xml file is used by Sonar so we don't need the HTML reports in this case.
I've searched on the Internet and looked at the code, but I don't think it's currently possible to skip the Doxia HTML generation.
I guess this is a similar question/request: https://stackoverflow.com/questions/42693443/why-maven-pmd-plugin-generate-pmd-html
Mojo classes should be refactored, currently we have, like:
@Mojo(name = "check", defaultPhase = LifecyclePhase.VERIFY, threadSafe = true)
@Execute(goal = "pmd")
public class PmdViolationCheckMojo extends AbstractPmdViolationCheckMojo<Violation> {
Additional mojo execution @Execute(goal = "pmd") shuld be removed and Mojo should directly use org.apache.maven.plugins.pmd.exec.PmdExecutor
I need this too! I just ran into this problem yesterday and can't figure out any way to configure the pmd-maven-plugin to only generate the XML findings file, but NOT the HTML report. I just reported the same issue for the spotbugs-maven-plugin: https://github.com/spotbugs/spotbugs-maven-plugin/discussions/1055
I had similar problem: https://issues.apache.org/jira/browse/MPMD-403 (for different reason but I wanted similar outcome).
https://issues.apache.org/jira/browse/MPMD-403?focusedCommentId=17880071&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-17880071:
For completeness - with
:pmdbeing reporting plugin, and with no goal (that I could find) to do non-reporting analysis to producepmd.xmlonly, with reporting context (and checking for skin) being prepared early, I'm able to work around my original problem, by configuring doxia to use other thanhtmlformat (and not fail for project with not updatedsite.xml).
And I tried to introduce
- https://github.com/apache/maven-doxia/pull/227
which then seemed for me easier than
Mojo classes should be refactored.
After all - I'd like to see Generate pmd.xml, but skip HTML generation as well!
I would like to try a refactor, simply check is not a report goal ... so we should not call a report by directly PmdExecutor where is needed.
Haha talked with @khmarbaise about this confusing situation too at work.
Please do it for both pmd and cpd goals and try to avoid the need the fork, so generating the xml-report (to be consumed by other tools) during build lifecycle.
Firs step of refactor:
- #206
Will be easier use executors in reports and mojos
next step of refactor:
- #210
FYI: I found another reason, why we should not fork a lifecycle (pmd:check forking lifecycle to call pmd:pmd) - a customer has some maven projects with big dependency graphs (lots of dependencies, mostly snapshots), and it takes a couple of minutes to resolve the dependencies of the project. These couple of minutes are doubled, because it seems that for the forked lifecycle, maven needs to resolve the dependencies again for pmd:pmd... Removing this fork at least would reduce the build times for such projects when using pmd.
@slawekjaranowski - 4 months have gone by, Any more progress on this?
@davewichers I did first refactor in
- #206
Now we can move code from CpdReport / PmdReport into corresponding CpdServiceExecutor / PmdServiceExecutor
and finally use it in both report and check mojos.
simply my voluntarily time is limited - I hope work can be continued by others, especially if you need it
so question is why nobody didn't try to resolve it?