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 03:30:10 UTC

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

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


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


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

Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-1043?page=all ]
     
Brett Porter closed MNG-1043:
-----------------------------

      Assign To: Brett Porter
     Resolution: Fixed
    Fix Version: 2.0-beta-3

applied, thanks. please try and avoid inconsequential changes in patches though (ie, stick to the existing formatting, don't move imports around, don't change whitespace).

> 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


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

Posted by "Ken Weiner (JIRA)" <ji...@codehaus.org>.
    [ 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


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

Posted by "Ken Weiner (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-1043?page=all ]

Ken Weiner updated MNG-1043:
----------------------------

    Attachment: PmdReport-patch.txt

Patch that addresses this issue.  Apply to the maven-pmd-plugin directory.
Thanks to Carlos Sanchez who pointed out to me that Plexus injects the configuration properties.

> 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
>  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


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

Posted by "Subhash Chandran (JIRA)" <ji...@codehaus.org>.
    [ 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