Objective-C-CPD-Language icon indicating copy to clipboard operation
Objective-C-CPD-Language copied to clipboard

PMD 5.0.0 incompatible with ObjCLanguage-0.0.7-SNAPSHOT.jar

Open ellemenno opened this issue 12 years ago • 3 comments

When using PMD 5.0.0, I get the following error message for every file, and hence no output:

java.lang.NoSuchMethodError: net.sourceforge.pmd.cpd.SourceCode.getCodeBuffer()Ljava/lang/StringBuffer;
    at net.sourceforge.pmd.cpd.ObjectivecTokenizer.tokenize(ObjectivecTokenizer.java:27)
    at net.sourceforge.pmd.cpd.CPD.add(CPD.java:102)
    at net.sourceforge.pmd.cpd.CPD.add(CPD.java:68)
    at net.sourceforge.pmd.cpd.CPD.addDirectory(CPD.java:78)
    at net.sourceforge.pmd.cpd.CPD.addRecursively(CPD.java:63)
    at net.sourceforge.pmd.cpd.CPD.main(CPD.java:138)

my CPD command line looks like this (added the logging flag temporarily to get above err msg):

java
-DObjC-CPD-LoggingEnabled=YES
-Xmx512m
-classpath "/tools/pmd/lib/asm-3.2.jar:/tools/pmd/lib/jaxen-1.1.1.jar:/tools/pmd/lib/pmd-5.0.0.jar:/tools/pmd/lib/ObjCLanguage-0.0.7-SNAPSHOT.jar"
net.sourceforge.pmd.cpd.CPD
--files "/project/files/"
--minimum-tokens 100
--language ObjectiveC
--encoding UTF-8
--format net.sourceforge.pmd.cpd.XMLRenderer
> "cpd.xml"

Work-around: download and use PMD 4.2.6.

ellemenno avatar Nov 15 '12 18:11 ellemenno

It is fixed here: https://github.com/Jennifer-fu/Objective-C-CPD-Language/tree/master/releases/ObjCLanguage-0.0.8-SNAPSHOT.jar

Jennifer-fu avatar Jul 02 '13 06:07 Jennifer-fu

Jennifer-fu I tried the latest CPD with that ObjCLanguage snapshot, and it didn't work. I had to go back to the old CPD. I want to use the latest CPD so I can get exclude files support... I have 20,000 lines of false positives.

kylerobson avatar Jul 15 '14 18:07 kylerobson

Most easy way to fix it, copy paste the ObjCLanguage-0.0.8-SNAPSHOT.jar to latest PMD 5.1.3 /lib folder, so it will be auto included in to the java path, run pmd-5.1.2/bin/run.sh instead, since it need more dependency now, so the command is something like

./run.sh cpd --minimum-tokens 100 --language ObjectiveC --files xxxxxxxxx

wli3 avatar Oct 02 '14 20:10 wli3