Maven PMD Plugin
  1. Maven PMD Plugin
  2. MPMD-127

Report cannot correctly handle external PMD ruleset as exported by Sonar QA Dashboard

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.5
    • Fix Version/s: 2.6
    • Component/s: PMD
    • Labels:
      None
    • Environment:
      OS: Microsoft Windows 7 Professional x86 64-bit NL
      Java: JDK 1.6.0_22 64-bit
      Maven: 2.2.1
      Eclipse:
      Maven cmd: clean deploy site:site site:deploy
    • Number of attachments :
      1

      Description

      Sonar (http://www.sonarsource.org/) offers a way to centrally manage the PMD ruleset configuration and publish the specified configuration on a URL.

      The url takes the following form:
      http://nemo.sonarsource.org/profiles/export?format=pmd&language=java&name=Nemo%2520rules%2520with%2520findbugs

      Plugin config:

      <plugin>
      	<groupId>org.apache.maven.plugins</groupId>
      	<artifactId>maven-pmd-plugin</artifactId>
      	<version>2.5</version>
      	<configuration>
      		<linkXref>true</linkXref>
      		<sourceEncoding>utf-8</sourceEncoding>
      		<targetJdk>1.6</targetJdk>
      		<rulesets>
      			<ruleset>http://nemo.sonarsource.org/profiles/export?format=pmd&language=java&name=Nemo%2520rules%2520with%2520findbugs</ruleset>
      		</rulesets>
      	</configuration>
      </plugin>
      

      When generating a PMD report (as part of site:site) the plugin fails (on specified environment) with the following error:

      [INFO] Generating "PMD Report" report.
      [DEBUG] Preparing ruleset: http://nemo.sonarsource.org/profiles/export?format=pmd&language=java&name=Nemo%2520rules%2520with%2520findbugs
      [DEBUG] Before: http://nemo.sonarsource.org/profiles/export?format=pmd&language=java&name=Nemo%2520rules%2520with%2520findbugs After: export?format=pmd&language=java&name=Nemo%2520rules%2520with%2520findbugs
      ...<snip>...
      
      [INFO] ------------------------------------------------------------------------
      [ERROR] BUILD ERROR
      [INFO] ------------------------------------------------------------------------
      [INFO] Error during page generation
      
      Embedded error: Error rendering Maven report: Cannot create file-based resource:<workspace>\<project>\<module>\target\export?format=pmd&language=java&name=Nemo%2520rules%2520with%2520findbugs (De syntaxis van de bestandsnaam, mapnaam of volumenaam is onjuist)
      [INFO] ------------------------------------------------------------------------
      [DEBUG] Trace
      
      org.apache.maven.lifecycle.LifecycleExecutionException: Error during page generation
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
      	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
      	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
      	at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
      	at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
      	at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
      	at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
      	at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
      Caused by: org.apache.maven.plugin.MojoExecutionException: Error during page generation
      	at org.apache.maven.plugins.site.SiteMojo.execute(SiteMojo.java:105)
      	at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
      	... 17 more
      Caused by: org.apache.maven.doxia.siterenderer.RendererException: Error rendering Maven report: Cannot create file-based resource:<workspace>\<project>\<module>\target\export?format=pmd&language=java&name=Nemo%2520rules%2520with%2520findbugs (De syntaxis van de bestandsnaam, mapnaam of volumenaam is onjuist)
      	at org.apache.maven.plugins.site.ReportDocumentRenderer.renderDocument(ReportDocumentRenderer.java:149)
      	at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.renderModule(DefaultSiteRenderer.java:269)
      	at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.render(DefaultSiteRenderer.java:101)
      	at org.apache.maven.plugins.site.SiteMojo.renderLocale(SiteMojo.java:133)
      	at org.apache.maven.plugins.site.SiteMojo.execute(SiteMojo.java:100)
      	... 19 more
      Caused by: org.apache.maven.reporting.MavenReportException: Cannot create file-based resource:<workspace>\<project>\<module>\target\export?format=pmd&language=java&name=Nemo%2520rules%2520with%2520findbugs (De syntaxis van de bestandsnaam, mapnaam of volumenaam is onjuist)
      	at org.apache.maven.plugin.pmd.PmdReport.generateReport(PmdReport.java:236)
      	at org.apache.maven.plugin.pmd.PmdReport.execute(PmdReport.java:168)
      	at org.apache.maven.plugin.pmd.PmdReport.executeReport(PmdReport.java:142)
      	at org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:131)
      	at org.apache.maven.plugins.site.ReportDocumentRenderer.renderDocument(ReportDocumentRenderer.java:139)
      	... 23 more
      Caused by: org.codehaus.plexus.resource.loader.FileResourceCreationException: Cannot create file-based resource:<workspace>\<project>\<module>\target\export?format=pmd&language=java&name=Nemo%2520rules%2520with%2520findbugs (De syntaxis van de bestandsnaam, mapnaam of volumenaam is onjuist)
      	at org.codehaus.plexus.resource.DefaultResourceManager.createResourceAsFile(DefaultResourceManager.java:220)
      	at org.codehaus.plexus.resource.DefaultResourceManager.getResourceAsFile(DefaultResourceManager.java:101)
      	at org.apache.maven.plugin.pmd.PmdReport.generateReport(PmdReport.java:205)
      	... 27 more
      Caused by: java.io.FileNotFoundException: <workspace>\<project>\<module>\target\export?format=pmd&language=java&name=Nemo%2520rules%2520with%2520findbugs (De syntaxis van de bestandsnaam, mapnaam of volumenaam is onjuist)
      	at java.io.FileOutputStream.open(Native Method)
      	at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
      	at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
      	at org.codehaus.plexus.resource.DefaultResourceManager.createResourceAsFile(DefaultResourceManager.java:211)
      	... 29 more
      

      P.s. sorry for the dutch windows errors.

        Activity

        Hide
        Tjerk Stroband added a comment -

        Attached is a patch that will replace some special url characters in the location of the temporary file. Characters replaced are ? : % + = and will be replaced by "_" (underscore)

        Unit test included

        Show
        Tjerk Stroband added a comment - Attached is a patch that will replace some special url characters in the location of the temporary file. Characters replaced are ? : % + = and will be replaced by "_" (underscore) Unit test included
        Hide
        Tjerk Stroband added a comment -

        It seems I cannot edit this issue to set the 'patch attached' flag to true. Perhaps a project admin can do that for me? Thanks in advance!

        Show
        Tjerk Stroband added a comment - It seems I cannot edit this issue to set the 'patch attached' flag to true. Perhaps a project admin can do that for me? Thanks in advance!
        Hide
        Olivier Lamy added a comment -

        fixed rev 1159144
        Thanks !

        Show
        Olivier Lamy added a comment - fixed rev 1159144 Thanks !

          People

          • Assignee:
            Olivier Lamy
            Reporter:
            Tjerk Stroband
          • Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: