Menu

Javascript analysis with Maven

Developers
2017-02-06
2017-02-06
  • Jerome Bautista

    Jerome Bautista - 2017-02-06

    Hi, I'm currently trying out PMD as a possible static analysis tool that our company can use. I've analyzed Java files with no problems whatsoever, but I couldn't seem to do it with Javascript, everytime I execute pmd:pmd it just analyses java files again. Anyways, here is a snippet of my POM.xml:

    *Using Maven 3.3.1

    <build>
    <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <version>3.0.0</version>
    <configuration>
    <sources>
    ${basedir}/src/main/webapp/js
    </sources>
    </configuration>
    <executions>
    <execution>
    <goals>
    <goal>add-source</goal>
    </goals>
    </execution>
    </executions>
    </plugin>
    </build>

    <reporting>
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-pmd-plugin</artifactId>
    <version>3.7</version>
    <configuration>
    <language>javascript</language>
    <rulesets>
    <ruleset>${basedir}/pmd-javascript/basic.xml</ruleset>

    </rulesets>
    <includes>
    <include>*/.js</include>
    </includes>
    </configuration>
    </plugin>
    </reporting>

    So I just followed the instructions indicated in https://maven.apache.org/plugins/maven-pmd-plugin/examples/javascriptReport.html but can't seem to make it work. Can you guys please tell me if I'm missing some required setups / configurations ? TIA.

     

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.