You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by "Subhash Chandran (JIRA)" <ji...@codehaus.org> on 2006/02/28 17:48:36 UTC

[jira] Commented: (MPMD-5) No way to configure the target JDK in PMD report plugin

    [ http://jira.codehaus.org/browse/MPMD-5?page=comments#action_59679 ] 

Subhash Chandran commented on MPMD-5:
-------------------------------------

Can somebody take the initiative to update the ibiblio repository to have version 2.0-beta-3 (which has this fix) of the maven-pmd-plugin.

> 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: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org