jkennedy1980 / Objective-C-CPD-Language

A CPD language definition for use with Objective-C source code
http://deadmeta4.com/2011/05/17/objective-c-copy-paste-detection-using-jenkins/
MIT License
48 stars 60 forks source link

PMD 5.0.0 incompatible with ObjCLanguage-0.0.7-SNAPSHOT.jar #8

Open ellemenno opened 11 years ago

ellemenno commented 11 years ago

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.

Jennifer-fu commented 11 years ago

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

kylerobson commented 10 years ago

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.

wli3 commented 10 years ago

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