Wednesday, 15 July 2015

checkstyle - Share specific PMD rulesets across multi module maven project -



checkstyle - Share specific PMD rulesets across multi module maven project -

i'm trying share same pmd configuration across submodules. i'm looking best way accomplish that

i thought place in parent project, did checkstyle plugin

parent pom.xml class="lang-xml prettyprint-override"><build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-checkstyle-plugin</artifactid> <version>2.9.1</version> <configuration> <configlocation>/src/main/config/checkstyle.xml</configlocation> </configuration> </plugin> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-pmd-plugin</artifactid> <version>2.7.1</version> <configuration> <rulesets> <ruleset>pmd.xml</ruleset> </rulesets> <linkxref>true</linkxref> <sourceencoding>${project.build.sourceencoding}</sourceencoding> <targetjdk>${maven.compiler.target}</targetjdk> </configuration> </plugin> </plugins> </build> multi module structure

here structure

class="lang-xml prettyprint-override">parent |-- src | `-- main | `-- resources | |-- pmd.xml | `-- checkstyle.xml |-- pom.xml |-- model | `-- pom.xml `-- webapp `-- pom.xml error

with configuration, obtain next error :

class="lang-xml prettyprint-override"> [error] failed execute goal org.apache.maven.plugins:maven-pmd-plugin:2.7.1:pmd (default-cli) on project model: error has occurred in pmd study report generation. not find resource 'pmd.xml'. -> [help 1] solution 1

i tried solution works me, because have 1 level on submodules : in close future, may have more levels, i'm not convinced that's method ${basedir}/../src/main/resources/pmd.xml

solution 2

without writing solution, can utilize assembly zip config , utilize in submodule dependency. work levels, overkilling !

here link explain it: how include resources war maven project

so i'm looking maven trick, don't or how ! every advice / clue welcome.

have separate module contains generic config files build-tools. can add together module dependency plugin config , load it.

i have implemented illustration of checkstyle config file across multiple modules in ksoap2-android project.

https://github.com/mosabua/ksoap2-android/blob/master/pom.xml

maven checkstyle pmd

No comments:

Post a Comment