[ http://jira.codehaus.org/browse/MPMD-5?page=all ]
Allan Ramirez moved MNG-1043 to MPMD-5: --------------------------------------- Fix Version: (was: 2.0-beta-3) Component: (was: maven-pmd-plugin) Workflow: jira (was: Maven) Key: MPMD-5 (was: MNG-1043) Project: Maven 2.x Pmd Plugin (was: Maven 2) > No way to configure the target JDK in PMD report plugin > ------------------------------------------------------- > > Key: MPMD-5 > URL: http://jira.codehaus.org/browse/MPMD-5 > Project: Maven 2.x Pmd Plugin > Type: Improvement > Reporter: Ken Weiner > Assignee: Brett Porter > Attachments: PmdReport-patch.txt > > > I tried to use the PMD report plugin with JDK 1.5 and got the following error: > Caused by: net.sourceforge.pmd.ast.ParseException: Can't use JDK 1.5 for loop > syntax when running in JDK 1.4 mode! > at > net.sourceforge.pmd.ast.JavaParser.checkForBadJDK15ForLoopSyntaxArgumentsUsage(JavaParser.java:36) > PMD supports the configuration of target JDK's including 1.3, 1.4, and 1.5. > The default is JDK 1.4. > To fix this, the class org.apache.maven.plugin.pmd.PmdReport needs to > instantiate the PMD class like this: > public void executeReport( Locale locale ) throws MavenReportException { > ... > String jdkVersion = getJdkVersion(); > PMD pmd = null; > if (jdkVersion != null && jdkVersion.equals("1.3")) { > pmd = new PMD(new TargetJDK1_3()); > } else if (jdkVersion != null && jdkVersion.equals("1.5")) { > pmd = new PMD(new TargetJDK1_5()); > } else { > pmd = new PMD(); > } > ... > } > I would help submit a patch if someone could help familiarize me with the > normal way of making a plugin configurable. I noticed that plugins can have > a <configuration> element, but I am not sure how the element values inside > this element can be read from the Mojo class, in this case PMDReport. After > a quick glance, I didn't see support in any of the Abstract classes. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]