Menu

Compile failed on iMac

Help
R. Jasper
2016-02-05
2016-02-07
  • R. Jasper

    R. Jasper - 2016-02-05

    Hi,running on iMac XOS 10.7.5:

    $ java -version
    java version "1.8.0_74"
    Java(TM) SE Runtime Environment (build 1.8.0_74-b02)

    $ ant compile
    Buildfile: /Users/Rob/pmd-bin-4.2.6/bin/build.xml

    BUILD FAILED
    /Users/Rob/pmd-bin-4.2.6/bin/build.xml:91: taskdef class net.sourceforge.retroweaver.ant.RetroWeaverTask cannot be found
    using the classloader AntClassLoader[/Users/Rob/pmd-bin-4.2.6/lib/asm-3.2.jar]

    What am I doing wrong here?
    Any help appreciated!

     
  • Andreas Dangel

    Andreas Dangel - 2016-02-06

    Hi, it looks like you are using a very old version of PMD. PMD 4.2.6 was released, when java5 was not so common - hence it used a RetroWeaverTask which backported java5 features for java4 :)

    Please have a look at the latest version (currently 5.4.1). It requires at least a java7 sdk (I see, you already have java8, which should be fine, too).
    You can either download the sources as a zip file from here or just fork the github repository.

    Please note, that we changed the build system to maven, see compiling PMD for more info on how to build PMD from sources.

    Regards,
    Andreas

     
  • R. Jasper

    R. Jasper - 2016-02-07

    Hello Andreas,
    I downloaded the newest version (thanks for pointing me to that).
    The process downloaded maven and subsequently failed:

    [INFO] Scanning for projects...
    [ERROR] The build could not read 2 projects -> [Help 1]
    [ERROR]
    [ERROR] The project net.sourceforge.pmd:pmd-java8:5.4.1-SNAPSHOT (/Users/Rob/pmd-pmd_releases-5.4.1/pmd-java8/pom.xml) has 1 error
    [ERROR] Non-resolvable parent POM: Could not find artifact net.sourceforge.pmd:pmd:pom:5.4.1-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 7, column 13 -> [Help 2]
    [ERROR]
    [ERROR] The project net.sourceforge.pmd:pmd-ui:5.4.1-SNAPSHOT (/Users/Rob/pmd-pmd_releases-5.4.1/pmd-ui/pom.xml) has 1 error
    [ERROR] Non-resolvable parent POM: Could not find artifact net.sourceforge.pmd:pmd:pom:5.4.1-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 7, column 13 -> [Help 2]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]

    Your help is appreciated.

     
  • Andreas Dangel

    Andreas Dangel - 2016-02-07

    Oh yes, these two modules "pmd-java8" and "pmd-ui" are for java8 only and pmd is released with java7 - hence the the parent pom version has not been adjusted during the release.

    You can disable the modules for now by executing this maven command:

    mvn -P\!jdk8-modules clean package
    

    This disables the profile "jdk8-modules" so that the two modules are not built.

     
  • R. Jasper

    R. Jasper - 2016-02-07

    Well, it now has done a lot, but...
    I want to run CPD but I found no bin directory. I found run.sh in
    pmd-pmd_releases-5.4.1/pmd-dist/src/main/scripts
    Running it from there doesn't work, it produces the following output:

    $ ./run.sh cpd --minimum-tokens 30 --files /Volumes/KINGSTON/JumarProject/
    ./run.sh: line 67: cd: ./../lib: No such file or directory
    Error: Could not find or load main class net.sourceforge.pmd.cpd.CPD

    I couldn't find the lib directory either..

    P.S. Running directly like suggested on the website:
    ...Or, if you have Java Web Start, you can run CPD by clicking here.
    where here is: http://pmd.sourceforge.net/cpd.jnlp does not work for me either..

     

    Last edit: R. Jasper 2016-02-07
  • Andreas Dangel

    Andreas Dangel - 2016-02-07

    After the compile, you'll find the binaries in pmd-dist/target. Take the file pmd-bin-5.4.1.zip and unzip whereever you want to install PMD. This also will contain CPD and you can run it like you mentioned above.

    Btw. - If you don't want to go through the trouble of compiling PMD on your own, you can just download the pre-built binaries -> https://github.com/pmd/pmd/releases/tag/pmd_releases/5.4.1 Take the file pmd-bin-5.4.1.zip.

     
    • R. Jasper

      R. Jasper - 2016-02-07

      I got the compiled version and it works like a charm. Thank you for pointing me to it.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.