CPD goal in maven plugin does not support txt format.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

CPD goal in maven plugin does not support txt format.

LINUS FERNANDES
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 | Threaded
Open this post in threaded view
|

Re: CPD goal in maven plugin does not support txt format.

LINUS FERNANDES
If this is a bug, where do I file it?

On Fri, 3 Jul 2020, 11:46 LINUS FERNANDES, <[hidden email]>
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 | Threaded
Open this post in threaded view
|

Re: CPD goal in maven plugin does not support txt format.

Greg Chabala
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 <[hidden email]>
wrote:

> If this is a bug, where do I file it?
>
> On Fri, 3 Jul 2020, 11:46 LINUS FERNANDES, <[hidden email]>
> 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 | Threaded
Open this post in threaded view
|

Re: CPD goal in maven plugin does not support txt format.

Greg Chabala
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 <[hidden email]> 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 <[hidden email]>
> wrote:
>
>> If this is a bug, where do I file it?
>>
>> On Fri, 3 Jul 2020, 11:46 LINUS FERNANDES, <[hidden email]>
>> 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 | Threaded
Open this post in threaded view
|

Re: CPD goal in maven plugin does not support txt format.

LINUS FERNANDES
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, <[hidden email]> 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 <[hidden email]>
> 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 <
> [hidden email]>
> > wrote:
> >
> >> If this is a bug, where do I file it?
> >>
> >> On Fri, 3 Jul 2020, 11:46 LINUS FERNANDES, <[hidden email]>
> >> 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 | Threaded
Open this post in threaded view
|

Re: CPD goal in maven plugin does not support txt format.

LINUS FERNANDES
The goals need an output file name as well, I think.

On Sat, 4 Jul 2020, 03:52 LINUS FERNANDES, <[hidden email]>
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, <[hidden email]> 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 <[hidden email]>
>> 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 <
>> [hidden email]>
>> > wrote:
>> >
>> >> If this is a bug, where do I file it?
>> >>
>> >> On Fri, 3 Jul 2020, 11:46 LINUS FERNANDES, <[hidden email]>
>> >> 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 | Threaded
Open this post in threaded view
|

Re: CPD goal in maven plugin does not support txt format.

LINUS FERNANDES
Thanks, Greg.

On Sat, 4 Jul 2020, 04:05 LINUS FERNANDES, <[hidden email]>
wrote:

> The goals need an output file name as well, I think.
>
> On Sat, 4 Jul 2020, 03:52 LINUS FERNANDES, <[hidden email]>
> 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, <[hidden email]> 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 <[hidden email]>
>>> 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 <
>>> [hidden email]>
>>> > wrote:
>>> >
>>> >> If this is a bug, where do I file it?
>>> >>
>>> >> On Fri, 3 Jul 2020, 11:46 LINUS FERNANDES, <[hidden email]
>>> >
>>> >> 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 | Threaded
Open this post in threaded view
|

Re: CPD goal in maven plugin does not support txt format.

LINUS FERNANDES
In reply to this post by Greg Chabala
>>>>>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 Sat, 4 Jul 2020, 01:53 Greg Chabala, <[hidden email]> 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 <[hidden email]>
> wrote:
>
> > If this is a bug, where do I file it?
> >
> > On Fri, 3 Jul 2020, 11:46 LINUS FERNANDES, <[hidden email]>
> > 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 | Threaded
Open this post in threaded view
|

Re: CPD goal in maven plugin does not support txt format.

Greg Chabala
In reply to this post by LINUS FERNANDES
>> '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 <[hidden email]>
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 <[hidden email]>
wrote:

> Thanks, Greg.
>
> On Sat, 4 Jul 2020, 04:05 LINUS FERNANDES, <[hidden email]>
> wrote:
>
> > The goals need an output file name as well, I think.
> >
> > On Sat, 4 Jul 2020, 03:52 LINUS FERNANDES, <[hidden email]>
> > 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, <[hidden email]> 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 <[hidden email]>
> >>> 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 <
> >>> [hidden email]>
> >>> > wrote:
> >>> >
> >>> >> If this is a bug, where do I file it?
> >>> >>
> >>> >> On Fri, 3 Jul 2020, 11:46 LINUS FERNANDES, <
> [hidden email]
> >>> >
> >>> >> 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 | Threaded
Open this post in threaded view
|

Re: CPD goal in maven plugin does not support txt format.

LINUS FERNANDES
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, <[hidden email]> 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 <[hidden email]>
> 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 <[hidden email]>
> wrote:
>
> > Thanks, Greg.
> >
> > On Sat, 4 Jul 2020, 04:05 LINUS FERNANDES, <[hidden email]>
> > wrote:
> >
> > > The goals need an output file name as well, I think.
> > >
> > > On Sat, 4 Jul 2020, 03:52 LINUS FERNANDES, <[hidden email]>
> > > 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, <[hidden email]>
> 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 <[hidden email]>
> > >>> 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 <
> > >>> [hidden email]>
> > >>> > wrote:
> > >>> >
> > >>> >> If this is a bug, where do I file it?
> > >>> >>
> > >>> >> On Fri, 3 Jul 2020, 11:46 LINUS FERNANDES, <
> > [hidden email]
> > >>> >
> > >>> >> 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 | Threaded
Open this post in threaded view
|

Re: CPD goal in maven plugin does not support txt format.

LINUS FERNANDES
Filled out two bug reports:

https://issues.apache.org/jira/plugins/servlet/mobile#issue/MPMD-306


https://issues.apache.org/jira/plugins/servlet/mobile#issue/MPMD-305





On Sat, 4 Jul 2020, 11:40 LINUS FERNANDES, <[hidden email]>
wrote:

> 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, <[hidden email]> 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 <[hidden email]
>> >
>> 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 <[hidden email]
>> >
>> wrote:
>>
>> > Thanks, Greg.
>> >
>> > On Sat, 4 Jul 2020, 04:05 LINUS FERNANDES, <[hidden email]>
>> > wrote:
>> >
>> > > The goals need an output file name as well, I think.
>> > >
>> > > On Sat, 4 Jul 2020, 03:52 LINUS FERNANDES, <[hidden email]
>> >
>> > > 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, <[hidden email]>
>> 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 <[hidden email]
>> >
>> > >>> 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 <
>> > >>> [hidden email]>
>> > >>> > wrote:
>> > >>> >
>> > >>> >> If this is a bug, where do I file it?
>> > >>> >>
>> > >>> >> On Fri, 3 Jul 2020, 11:46 LINUS FERNANDES, <
>> > [hidden email]
>> > >>> >
>> > >>> >> 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.
>> > >>> >> >
>> > >>> >> >
>> > >>> >> >
>> > >>> >> >
>> > >>> >>
>> > >>> >
>> > >>>
>> > >>
>> >
>>
>