3

I'm implementing the Maven CPD PMD plug-in to to spot and (fail the build) if any instances of code duplication are presennt in the project.

This all works fine. However, The output error to the terminal in intellij idea is in the form:

Terminal output:

CPD Failure: Found 31 lines of duplicated code at locations:

[INFO] C:\Users\bob\Documents\Project\Folder\src\main\java\HelloWorld.java line 330

[INFO] C:\Users\bob\Documents\Project\Folder\src\main\java\HelloWorld.java line 428

This works fine and how it should do,

although, I recently had experience implementing Maven Check Style plug-in, which output error looks like this :

[INFO] C:\Users\bob\Documents\Project\Folder\src\main\java\HelloWorld.java:428

This is infinitely more useful as I can just click on this "file path" and go directly to the file and line where this error occurs ie. HelloWorld.java at line 428.

so, my question is, is there anyway of getting intellij idea to "recognise" the output in the form:

[INFO] C:\Users\bob\Documents\Project\Folder\src\main\java\HelloWorld.java line 428

and making this "clickable" ??

Any help or insights will be greatly appreciated as having to manually navigate to the class is really annoying :( (especially as I have hundreds of errors).

Thanks all.. :)

Luke_P
  • 559
  • 5
  • 20
  • 1
    Based on [this answer to a similar question](http://stackoverflow.com/a/1012279/2492865), I would assume you cannot configure this in IntellIJ IDEA and instead need to find a way to configure it in the console output. It seems maven-checkstyle-plugin doesn't allow it, though. Perhaps you could play around and do some kind of deep customization via [AuditEventFormatter](http://checkstyle.sourceforge.net/apidocs/com/puppycrawl/tools/checkstyle/AuditEventFormatter.html), but it seems extremely complicated. – Anton Koscejev May 27 '16 at 10:40
  • 2
    the IntelliJ IDEA Plug-in "Awesome Console" gets me halfway there but does not hop to the line number :( . – Luke_P May 27 '16 at 11:08
  • That's a good idea! Someone has already submitted a [pull request to handle python log](https://github.com/anthraxx/intellij-awesome-console/issues/9). Perhaps you could create a similar pull request for Check Style output. – Anton Koscejev May 27 '16 at 11:22
  • so it turns out this is probably a bug, see [this question](http://stackoverflow.com/questions/42510982/intellij-idea-not-hyperlinking-to-source-files-in-maven-run-tool-window) for details – Luke_P Mar 07 '17 at 09:49

1 Answers1

0

With Intellij can you run your code using a Run Configuration rather than using the terminal? This will give you what you want.

Also, as a comment, Visual Studio Code does exactly what you want out of the box.

Ross Attrill
  • 2,288
  • 1
  • 19
  • 27