I had similar issues when making my custom PMD and Findbugs tasks for their 
rulesets.

For the singular root project checkstyle.xml:
build.gradle (checkstyleConfigFileName = 
rootProject.file('config/checkstyle/checkstyle.xml'))

For each project individually (assuming subproject injection):
build.gradle (checkstyleConfigFileName = 
file('config/checkstyle/checkstyle.xml'))

If you don't force it via something like the file() operator to pin the 
directory, you might be surprised what gets used during runtime depending upon 
which subdirectory something is invoked within, or which project something gets 
mapped during during subproject injection - as you've discovered.

-Spencer

--- On Thu, 1/20/11, Mathias Kalb <[email protected]> wrote:

From: Mathias Kalb <[email protected]>
Subject: [gradle-user] SuppressionFilter for Checkstyle at Multi Projects
To: [email protected]
Date: Thursday, January 20, 2011, 7:36 AM

Hi,

Checkstyle has a SuppressionFilter. You need to define a XML file with 
suppression rules.

config/checkstyle/checkstyle.xml

<module name="SuppressionFilter">
<property name="file" value="config/checkstyle/suppressions.xml"/>
</module>

It works with a single project, but it fails with a multi project.

I tried two solutions but they had the same problem. The check fails if it is 
started from the subproject.
The path for the suppression.xml is wrong.

1. one checkstyle.xml for all projects
build.gradle (checkstyleConfigFileName = "../config/checkstyle/checkstyle.xml")
setting.gradle (include "A", "B")
config/checkstyle/checkstyle.xml (SuppressionFilter: 
"config/checkstyle/suppressions.xml")
config/checkstyle/suppressions.xml
A/src/...
B/src/...

2. every project has its own checkstyle.xml (default as described at the 
UserGuide)
build.gradle
setting.gradle (include "A", "B")
A/src/...
A/config/checkstyle/checkstyle.xml (SuppressionFilter: 
"A/config/checkstyle/suppressions.xml")
A/config/checkstyle/suppressions.xml
B/src/...
B/config/checkstyle/checkstyle.xml (SuppressionFilter: 
"B/config/checkstyle/suppressions.xml")
B/config/checkstyle/suppressions.xml

I think that both solutions should work. Is it possible to inject the path from 
gradle?

regards,
Mathias Kalb


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





      

Reply via email to