Using CPD/PMD on the command line

1.7k Views Asked by At

I'm using PMD currently as an external tool in conjunction with ace editor on an online java IDE i'm developing. However I can't get the CPD batch file to work, I've tried the command they provide on the website documentation as well as a few alternatives. Could someone please give me the required command if i want to search for duplicate code? here is my cpd directory and project source. C:\Users\Neema\Desktop\pmd-bin-5.2.2\bin C:\Users\Neema\workspace\Gillespie\src I know this is simple, but if anyone could help it would bee GREATLY appreciated. Thank you

1

There are 1 best solutions below

2
adangel On

You should be able to start cpd with this command line:

C:\Users\Neema\Desktop\pmd-bin-5.2.2\bin\cpd --minimum-tokens 100 --files C:\Users\Neema\workspace\Gillespie\src --language java

Note, that cpd is a command line tool - if you don't run it from a console (e.g. cmd), then you won't see the output. You can try to redirect stdout into a file via this command line:

C:\Users\Neema\Desktop\pmd-bin-5.2.2\bin\cpd --minimum-tokens 100 --files C:\Users\Neema\workspace\Gillespie\src --language java > C:\Users\Neema\workspace\Gillespie\src\cpd-results.txt

The CPD documentation unfortunately doesn't describe to use the simple cpd.bat file in the bin folder (like above)...