The maven plugin does not allow setting the language level (1.3, 1.4 or 1.5) for PMD. This can be easily fixed by using 'targetjdk' property in the plugin script:
By default 'maven.pmd.targetjdk' can be equal to 'maven.compile.source'
regards,
Wim
Description
The maven plugin does not allow setting the language level (1.3, 1.4 or 1.5) for PMD. This can be easily fixed by using 'targetjdk' property in the plugin script:
Original plugin.jelly (version 1.7):
<j:choose>
<j:when test="${sourcesPresent == 'true'}">
<pmd rulesetfiles="${maven.pmd.rulesetfiles}">
<formatter type="xml" toFile="${maven.build.dir}/pmd-raw-report.xml"/>
<fileset dir="${pom.build.sourceDirectory}"
Change:
<j:choose>
<j:when test="${sourcesPresent == 'true'}">
<pmd rulesetfiles="${maven.pmd.rulesetfiles}" targetjdk="${maven.pmd.targetjdk}>
<formatter type="xml" toFile="${maven.build.dir}/pmd-raw-report.xml"/>
<fileset dir="${pom.build.sourceDirectory}"
By default 'maven.pmd.targetjdk' can be equal to 'maven.compile.source'
regards,
Wim
This fix causes the PMD report to fail if maven.compile.source is set to '1.2' with the following message:
Caused by: The targetjdk attribute, if used, must be set to either '1.3', '1.4', '1.5', '1.6' or 'jsp'
at net.sourceforge.pmd.ant.PMDTask.validate(PMDTask.java:250)
at net.sourceforge.pmd.ant.PMDTask.execute(PMDTask.java:117)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:195)
at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:250)
The workaround is to either use the previous version of the plugin or to set
dion gillard added a comment - 18/Jun/07 12:24 AM This fix causes the PMD report to fail if maven.compile.source is set to '1.2' with the following message:
Caused by: The targetjdk attribute, if used, must be set to either '1.3', '1.4', '1.5', '1.6' or 'jsp'
at net.sourceforge.pmd.ant.PMDTask.validate(PMDTask.java:250)
at net.sourceforge.pmd.ant.PMDTask.execute(PMDTask.java:117)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:195)
at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:250)
The workaround is to either use the previous version of the plugin or to set
maven.pmd.targetjdk=1.3
This fix causes the PMD report to fail if maven.compile.source is set to '1.2' with the following message:
Caused by: The targetjdk attribute, if used, must be set to either '1.3', '1.4', '1.5', '1.6' or 'jsp'
at net.sourceforge.pmd.ant.PMDTask.validate(PMDTask.java:250)
at net.sourceforge.pmd.ant.PMDTask.execute(PMDTask.java:117)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:195)
at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:250)
The workaround is to either use the previous version of the plugin or to set
maven.pmd.targetjdk=1.3