You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by "Ken Weiner (JIRA)" <ji...@codehaus.org> on 2005/09/29 18:25:12 UTC

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

    [ http://jira.codehaus.org/browse/MNG-1043?page=comments#action_47478 ] 

Ken Weiner commented on MNG-1043:
---------------------------------

Thanks. Sorry about the reshuffled imports and whitespace. I'll be more
careful next time.

> No way to configure the target JDK in PMD report plugin
> -------------------------------------------------------
>
>          Key: MNG-1043
>          URL: http://jira.codehaus.org/browse/MNG-1043
>      Project: Maven 2
>         Type: Improvement
>   Components: maven-pmd-plugin
>     Reporter: Ken Weiner
>     Assignee: Brett Porter
>      Fix For: 2.0-beta-3
>  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