You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Taras Pushyk (JIRA)" <ji...@codehaus.org> on 2012/11/23 10:04:13 UTC

[jira] (MPMD-158) Relative file name doesn't work when specifying ruleset

Taras Pushyk created MPMD-158:
---------------------------------

             Summary: Relative file name doesn't work when specifying ruleset
                 Key: MPMD-158
                 URL: https://jira.codehaus.org/browse/MPMD-158
             Project: Maven 2.x PMD Plugin
          Issue Type: Bug
          Components: PMD
    Affects Versions: 2.7.1
         Environment: Windows 7
            Reporter: Taras Pushyk


When ruleset specified as follows:
{code}
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-pmd-plugin</artifactId>
  <version>2.7.1</version>
  <configuration>
     <linkXref>false</linkXref
     <minimumTokens>100</minimumTokens
     <targetJdk>1.5</targetJdk>
     <rulesets>
       <ruleset>../config/basic.xml</ruleset>
     </rulesets>
  </configuration>
</plugin>
{code}
File is not resolved. Also following message appears on console:
[DEBUG] The resource '../config/basic.xml' was not found with resourceLoader org.codehaus.plexus.resource.loader.FileResourceLoader.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (MPMD-158) Relative file name doesn't work when specifying ruleset

Posted by "Dennis Lundberg (JIRA)" <ji...@codehaus.org>.
     [ https://jira.codehaus.org/browse/MPMD-158?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dennis Lundberg closed MPMD-158.
--------------------------------

    Resolution: Won't Fix
    
> Relative file name doesn't work when specifying ruleset
> -------------------------------------------------------
>
>                 Key: MPMD-158
>                 URL: https://jira.codehaus.org/browse/MPMD-158
>             Project: Maven 2.x PMD Plugin
>          Issue Type: Bug
>          Components: PMD
>    Affects Versions: 2.7.1
>         Environment: Windows 7
>            Reporter: Taras Pushyk
>         Attachments: MPMD-158-With-Child-Module.zip, MPMD-158.zip
>
>
> When ruleset specified as follows:
> {code}
> <plugin>
>   <groupId>org.apache.maven.plugins</groupId>
>   <artifactId>maven-pmd-plugin</artifactId>
>   <version>2.7.1</version>
>   <configuration>
>      <linkXref>false</linkXref
>      <minimumTokens>100</minimumTokens
>      <targetJdk>1.5</targetJdk>
>      <rulesets>
>        <ruleset>../config/basic.xml</ruleset>
>      </rulesets>
>   </configuration>
> </plugin>
> {code}
> File is not resolved. Also following message appears on console:
> [DEBUG] The resource '../config/basic.xml' was not found with resourceLoader org.codehaus.plexus.resource.loader.FileResourceLoader.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (MPMD-158) Relative file name doesn't work when specifying ruleset

Posted by "Dennis Lundberg (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MPMD-158?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=318059#comment-318059 ] 

Dennis Lundberg commented on MPMD-158:
--------------------------------------

Hi Taras,

The project you attached does fail. That is the expected behavior for Maven. Any file related configuration you provide for a plugin will always resolve from the module level.

What we are seeing here is really a Maven and Continuous Integration anti-pattern. A Maven project should never use files outside of the project's directory. For a multi module build this is almost certain to fail on a Continuous Integration server like Jenkins.
                
> Relative file name doesn't work when specifying ruleset
> -------------------------------------------------------
>
>                 Key: MPMD-158
>                 URL: https://jira.codehaus.org/browse/MPMD-158
>             Project: Maven 2.x PMD Plugin
>          Issue Type: Bug
>          Components: PMD
>    Affects Versions: 2.7.1
>         Environment: Windows 7
>            Reporter: Taras Pushyk
>         Attachments: MPMD-158-With-Child-Module.zip, MPMD-158.zip
>
>
> When ruleset specified as follows:
> {code}
> <plugin>
>   <groupId>org.apache.maven.plugins</groupId>
>   <artifactId>maven-pmd-plugin</artifactId>
>   <version>2.7.1</version>
>   <configuration>
>      <linkXref>false</linkXref
>      <minimumTokens>100</minimumTokens
>      <targetJdk>1.5</targetJdk>
>      <rulesets>
>        <ruleset>../config/basic.xml</ruleset>
>      </rulesets>
>   </configuration>
> </plugin>
> {code}
> File is not resolved. Also following message appears on console:
> [DEBUG] The resource '../config/basic.xml' was not found with resourceLoader org.codehaus.plexus.resource.loader.FileResourceLoader.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (MPMD-158) Relative file name doesn't work when specifying ruleset

Posted by "Taras Pushyk (JIRA)" <ji...@codehaus.org>.
     [ https://jira.codehaus.org/browse/MPMD-158?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Taras Pushyk updated MPMD-158:
------------------------------

    Attachment: MPMD-158-With-Child-Module.zip

Sorry for late response. Now I noticed that issue appears whenever there is Maven child project and PMD plugin tries to resolve ruleset file relative to child project location. I've modified you exemplary project to let you reproduce the issue.
                
> Relative file name doesn't work when specifying ruleset
> -------------------------------------------------------
>
>                 Key: MPMD-158
>                 URL: https://jira.codehaus.org/browse/MPMD-158
>             Project: Maven 2.x PMD Plugin
>          Issue Type: Bug
>          Components: PMD
>    Affects Versions: 2.7.1
>         Environment: Windows 7
>            Reporter: Taras Pushyk
>         Attachments: MPMD-158-With-Child-Module.zip, MPMD-158.zip
>
>
> When ruleset specified as follows:
> {code}
> <plugin>
>   <groupId>org.apache.maven.plugins</groupId>
>   <artifactId>maven-pmd-plugin</artifactId>
>   <version>2.7.1</version>
>   <configuration>
>      <linkXref>false</linkXref
>      <minimumTokens>100</minimumTokens
>      <targetJdk>1.5</targetJdk>
>      <rulesets>
>        <ruleset>../config/basic.xml</ruleset>
>      </rulesets>
>   </configuration>
> </plugin>
> {code}
> File is not resolved. Also following message appears on console:
> [DEBUG] The resource '../config/basic.xml' was not found with resourceLoader org.codehaus.plexus.resource.loader.FileResourceLoader.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (MPMD-158) Relative file name doesn't work when specifying ruleset

Posted by "Taras Pushyk (JIRA)" <ji...@codehaus.org>.
     [ https://jira.codehaus.org/browse/MPMD-158?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Taras Pushyk reopened MPMD-158:
-------------------------------


Hi Denis!
Yes, I agree that this is expected behavior for Maven (resolving resources from a module level). But it is unexpected behavior for Maven PMD Plugin, it looks like it works inefficiently and tries to re-read configurations for every sub-module. 

Let me explain my idea: we have aggregator parent project with many child sub-modules. Additionally it is a holder for PMD configuration files. So, I want to benefit from such Maven feature as plugin inheritance which should allow me to define/configure PMD plug-in at parent project level but to execute it for all child sub-modules. What could you recommend in my situation? And I don't want to duplicate PMD configuraion files for all child sub-mudules where PMD report is needed.

Currently we are using workaround with PMD configuration location set with an URL to configuration files our CI server which is not a good solution. 

Btw, same thing (relative configuration file reference) works perfectly for Maven Checkstyle plug-in...

Thanks for your support
                
> Relative file name doesn't work when specifying ruleset
> -------------------------------------------------------
>
>                 Key: MPMD-158
>                 URL: https://jira.codehaus.org/browse/MPMD-158
>             Project: Maven 2.x PMD Plugin
>          Issue Type: Bug
>          Components: PMD
>    Affects Versions: 2.7.1
>         Environment: Windows 7
>            Reporter: Taras Pushyk
>         Attachments: MPMD-158-With-Child-Module.zip, MPMD-158.zip
>
>
> When ruleset specified as follows:
> {code}
> <plugin>
>   <groupId>org.apache.maven.plugins</groupId>
>   <artifactId>maven-pmd-plugin</artifactId>
>   <version>2.7.1</version>
>   <configuration>
>      <linkXref>false</linkXref
>      <minimumTokens>100</minimumTokens
>      <targetJdk>1.5</targetJdk>
>      <rulesets>
>        <ruleset>../config/basic.xml</ruleset>
>      </rulesets>
>   </configuration>
> </plugin>
> {code}
> File is not resolved. Also following message appears on console:
> [DEBUG] The resource '../config/basic.xml' was not found with resourceLoader org.codehaus.plexus.resource.loader.FileResourceLoader.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (MPMD-158) Relative file name doesn't work when specifying ruleset

Posted by "Dennis Lundberg (JIRA)" <ji...@codehaus.org>.
     [ https://jira.codehaus.org/browse/MPMD-158?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dennis Lundberg updated MPMD-158:
---------------------------------

    Attachment: MPMD-158.zip

This sample project works for me. How does it differ from what you are using?
                
> Relative file name doesn't work when specifying ruleset
> -------------------------------------------------------
>
>                 Key: MPMD-158
>                 URL: https://jira.codehaus.org/browse/MPMD-158
>             Project: Maven 2.x PMD Plugin
>          Issue Type: Bug
>          Components: PMD
>    Affects Versions: 2.7.1
>         Environment: Windows 7
>            Reporter: Taras Pushyk
>         Attachments: MPMD-158.zip
>
>
> When ruleset specified as follows:
> {code}
> <plugin>
>   <groupId>org.apache.maven.plugins</groupId>
>   <artifactId>maven-pmd-plugin</artifactId>
>   <version>2.7.1</version>
>   <configuration>
>      <linkXref>false</linkXref
>      <minimumTokens>100</minimumTokens
>      <targetJdk>1.5</targetJdk>
>      <rulesets>
>        <ruleset>../config/basic.xml</ruleset>
>      </rulesets>
>   </configuration>
> </plugin>
> {code}
> File is not resolved. Also following message appears on console:
> [DEBUG] The resource '../config/basic.xml' was not found with resourceLoader org.codehaus.plexus.resource.loader.FileResourceLoader.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira