Replies: 1 comment
-
Since you are mentioning This is for javascript, so you'll need to adjust it. Apex/Visualforce is not by default a dependency in the maven-pmd-plugin (only java, javascript, jsp are default dependencies), so you'll need to add these first (similar to Upgrading PMD at Runtime). Then you need to tell, where the sources are and how the files are named (maven is mostly a java build tool, so it defaults to java). <properties>
<pmdVersion>6.40.0</pmdVersion>
</properties>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.15.0</version>
<configuration>
<language>apex</language>
<rulesets>
<ruleset>/rulesets/apex/quickstart.xml</ruleset>
<ruleset>TODO/ruleset/for/visualforce.xml</ruleset>
</rulesets>
<includes>
<include>**/*.cls</include>
<include>**/*.page</include>
</includes>
<compileSourceRoots>
<compileSourceRoot>${basedir}/classes</compileSourceRoot>
<compileSourceRoot>${basedir}/pages</compileSourceRoot>
</compileSourceRoots>
</configuration>
<reportSets>
<reportSet>
<reports>
<report>pmd</report>
</reports>
</reportSet>
</reportSets>
<dependencies>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-core</artifactId>
<version>${pmdVersion}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-java</artifactId>
<version>${pmdVersion}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-javascript</artifactId>
<version>${pmdVersion}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-jsp</artifactId>
<version>${pmdVersion}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-apex</artifactId>
<version>${pmdVersion}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-visualforce</artifactId>
<version>${pmdVersion}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</reporting> Notes:
Since I don't think that maven is the default build tool for apex, maybe it's easier to just use the PMD CLI. You'd need to figure out, how PMD is installed on your jenkins instance and the add a little script to your build plan to execute PMD. This will generate the file "pmd.xml", which can then be analyzed and visualized by warnings-ng. |
Beta Was this translation helpful? Give feedback.
-
Could you please help me with the pom.xml such that the jenkins runs the PMD for Salesforce(Apex/Visualforce pages).
I am stuck here.
Beta Was this translation helpful? Give feedback.
All reactions