Isn't the Maven plugin supposed to give me the same kind of output that I'd
get either from the CLI or the Ant task?

Maven reports are usually output in html in the site lifecycle and that's
usually viewed from the browser.

If it's not supported, the documentation must state that.

Outputting the XML as well is a side effect , in my opinion, when I'm
seeking only for the text output.


On Sat, 4 Jul 2020, 09:40 Greg Chabala, <[email protected]> wrote:

> >> 'text' doesn't work.
> >> In my opinion, txt and text should both be viable options.
> >>
> >> The PMD goal rejects 'text' and only accepts 'txt'.
>
> Sorry about that. Just a guess on my part from looking at the source of
> TextRenderer
> <
> https://github.com/pmd/pmd/blob/master/pmd-core/src/main/java/net/sourceforge/pmd/renderers/TextRenderer.java#L22
> >,
> since it registers itself using "text". But that's in PMD itself, looks
> like the plugin is doing its own thing with configuration codes.
>
> >> Any particular reason why Maven developers don't seem to like outputting
> >> text output? I see something similar with the Spotbugs plugin. There's
> no
> >> text output either and the XML output is too verbose for my liking.
>
> I've used maven-pmd-plugin myself, and I think it works great. I reference
> the plugin in the reporting section of my build, and the reports get
> generated with the site goal. I expect reading the HTML reports as part of
> the generated site does the job for most folks. And if one wanted to do
> something with the report programmatically, there's the xml report for
> that. It seems your wish for text output is a bit far from the happy path,
> since no one noticed it was broken.
>
> Just poking around in the blame, this looks like the commit that removed
> the "txt" support, 14 years ago:
>
> https://github.com/apache/maven-pmd-plugin/commit/e64025962e6babb82435099673a635ab497f2a6b#diff-b57f29ee2de2392a1af539fb7c05ec76L224
>
> >> Specifying             sourceforge.pmd.cpd.SimpleRenderer
> >> works but it outputs a file as the full class name and ignores the
> >> skipEmptyReport configuration value set to true.
>
> That sounds pretty good to me. Could still try the TextRenderer to see if
> it performs more to your liking.
>
> >> It also generates a cpd.xml file.
>
> Always. It says that right in the code:
>
> https://github.com/apache/maven-pmd-plugin/blob/master/src/main/java/org/apache/maven/plugins/pmd/CpdReport.java#L311
>
> // always create XML format. we need to output it even if the file list is
> > empty or we have no duplications
> > // so the "check" goals can check for violations
> > writeXmlReport( cpd );
>
>
> Greg
>
> On Fri, Jul 3, 2020 at 6:14 PM LINUS FERNANDES <[email protected]>
> wrote:
>
> > >>>>>You want the text renderer?
> >
> >
> https://github.com/pmd/pmd/blob/master/pmd-core/src/main/java/net/sourceforge/pmd/renderers/TextRenderer.java
> >
> > What do you mean? Obviously, I want text output, not XML. I prefer less
> > verbose output since I'm looking at it through a text editor.
> >
> >
> On Fri, Jul 3, 2020 at 5:40 PM LINUS FERNANDES <[email protected]>
> wrote:
>
> > Thanks, Greg.
> >
> > On Sat, 4 Jul 2020, 04:05 LINUS FERNANDES, <[email protected]>
> > wrote:
> >
> > > The goals need an output file name as well, I think.
> > >
> > > On Sat, 4 Jul 2020, 03:52 LINUS FERNANDES, <[email protected]>
> > > wrote:
> > >
> > >> Any particular reason why Maven developers don't seem to like
> outputting
> > >> text output? I see something similar with the Spotbugs plugin. There's
> > no
> > >> text output either and the XML output is too verbose for my liking.
> > >> I've already filed an issue concerning that.
> > >>
> > >> 'text' doesn't work.
> > >> In my opinion, txt and text should both be viable options.
> > >>
> > >> The PMD goal rejects 'text' and only accepts 'txt'.
> > >>
> > >> Since they're from the same Maven family, the CPD goal must accept txt
> > as
> > >> an option as well. And the documentation is misleading when it says it
> > >> supports specifying 'txt' as an input.
> > >>
> > >> Specifying             sourceforge.pmd.cpd.SimpleRenderer
> > >> works but it outputs a file as the full class name and ignores the
> > >> skipEmptyReport configuration value set to true.
> > >>
> > >> It also generates a cpd.xml file.
> > >>
> > >> Where does a bug report go?
> > >> Jira or the pmd Github repo?
> > >>
> > >> Is there a specific tag for the pmd maven plugin?
> > >>
> > >>
> > >>
> > >>
> > >> On Sat, 4 Jul 2020, 01:56 Greg Chabala, <[email protected]>
> wrote:
> > >>
> > >>> Better still, use the full classname of the renderer, looks like the
> > >>> plugin
> > >>> only know how to handle xml and csv:
> > >>>
> > >>>
> >
> https://github.com/apache/maven-pmd-plugin/blob/master/src/main/java/org/apache/maven/plugins/pmd/CpdReport.java#L456
> > >>>
> > >>> On Fri, Jul 3, 2020 at 3:22 PM Greg Chabala <[email protected]>
> > >>> wrote:
> > >>>
> > >>> > Looks like a typo in the documentation. From your link "See the
> > >>> > net.sourceforge.pmd.renderers package javadoc for available
> > renderers".
> > >>> >
> > >>> > You want the text renderer?
> > >>> >
> > >>>
> >
> https://github.com/pmd/pmd/blob/master/pmd-core/src/main/java/net/sourceforge/pmd/renderers/TextRenderer.java
> > >>> >
> > >>> > Try "text" instead of "txt".
> > >>> >
> > >>> > On Fri, Jul 3, 2020 at 2:18 AM LINUS FERNANDES <
> > >>> [email protected]>
> > >>> > wrote:
> > >>> >
> > >>> >> If this is a bug, where do I file it?
> > >>> >>
> > >>> >> On Fri, 3 Jul 2020, 11:46 LINUS FERNANDES, <
> > [email protected]
> > >>> >
> > >>> >> wrote:
> > >>> >>
> > >>> >> >
> > >>> >> > I receive the following message while using the cpd goal in the
> > PMD
> > >>> >> maven
> > >>> >> > plugin.
> > >>> >> >
> > >>> >> > maven.plugins:maven-pmd-plugin:3.13.0:cpd (cpd) on project
> > DSAlgos:
> > >>> >> > Execution cpd of goal
> > >>> >> org.apache.maven.plugins:maven-pmd-plugin:3.13.0:cpd
> > >>> >> > failed: org.apache.maven.reporting.MavenReportException: Can't
> > find
> > >>> CPD
> > >>> >> > custom format txt: java.lang.ClassNotFoundException
> > >>> >> >
> > >>> >> > The documentation states that the txt format is supported.
> > >>> >> >
> > >>> >> >
> > >>>
> https://maven.apache.org/plugins/maven-pmd-plugin/cpd-mojo.html#format
> > >>> >> >
> > >>> >> > The pmd goal supports the txt format.
> > >>> >> >
> > >>> >> >
> > >>> >> > Regards,
> > >>> >> > Linus.
> > >>> >> >
> > >>> >> >
> > >>> >> >
> > >>> >> >
> > >>> >>
> > >>> >
> > >>>
> > >>
> >
>

Reply via email to