Mercurial > hg > thermostat-ng > agent
changeset 2775:a4d9e2b10254
Setup maven-pmd-plugin for automated static code analysis
Reviewed-by: neugens, stooke
Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2017-October/025270.html
author | Miloslav Zezulka <mzezulka@redhat.com> |
---|---|
date | Tue, 03 Oct 2017 15:02:21 +0200 |
parents | 4592c11860e4 |
children | 6ea7021a74d6 |
files | build-tools/pom.xml build-tools/src/main/resources/rulesets/pmdRulesets.xml pom.xml |
diffstat | 3 files changed, 152 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build-tools/pom.xml Tue Oct 03 15:02:21 2017 +0200 @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Copyright 2012-2017 Red Hat, Inc. + + This file is part of Thermostat. + + Thermostat is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 2, or (at your + option) any later version. + + Thermostat is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Thermostat; see the file COPYING. If not see + <http://www.gnu.org/licenses/>. + + Linking this code with other modules is making a combined work + based on this code. Thus, the terms and conditions of the GNU + General Public License cover the whole combination. + + As a special exception, the copyright holders of this code give + you permission to link this code with independent modules to + produce an executable, regardless of the license terms of these + independent modules, and to copy and distribute the resulting + executable under terms of your choice, provided that you also + meet, for each linked independent module, the terms and conditions + of the license of that module. An independent module is a module + which is not derived from or based on this code. If you modify + this code, you may extend this exception to your version of the + library, but you are not obligated to do so. If you do not wish + to do so, delete this exception statement from your version. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>com.redhat.thermostat</groupId> + <version>1.0</version> + <artifactId>build-tools</artifactId> + <name>Build Tools</name> +</project> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build-tools/src/main/resources/rulesets/pmdRulesets.xml Tue Oct 03 15:02:21 2017 +0200 @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Copyright 2012-2017 Red Hat, Inc. + + This file is part of Thermostat. + + Thermostat is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 2, or (at your + option) any later version. + + Thermostat is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Thermostat; see the file COPYING. If not see + <http://www.gnu.org/licenses/>. + + Linking this code with other modules is making a combined work + based on this code. Thus, the terms and conditions of the GNU + General Public License cover the whole combination. + + As a special exception, the copyright holders of this code give + you permission to link this code with independent modules to + produce an executable, regardless of the license terms of these + independent modules, and to copy and distribute the resulting + executable under terms of your choice, provided that you also + meet, for each linked independent module, the terms and conditions + of the license of that module. An independent module is a module + which is not derived from or based on this code. If you modify + this code, you may extend this exception to your version of the + library, but you are not obligated to do so. If you do not wish + to do so, delete this exception statement from your version. + +--> +<ruleset name="Agent PMD ruleset" + xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd"> + + <description> + Ruleset definition for Thermostat-ng agent module. + </description> + + <rule ref="rulesets/java/basic.xml"/> +</ruleset> \ No newline at end of file
--- a/pom.xml Mon Oct 09 15:34:47 2017 +0200 +++ b/pom.xml Tue Oct 03 15:02:21 2017 +0200 @@ -330,6 +330,11 @@ <mongodb.dev.username> mongodevuser </mongodb.dev.username> <mongodb.dev.password> mongodevpassword </mongodb.dev.password> <coverageSkip> true </coverageSkip> + + <pmd.plugin.version>3.8</pmd.plugin.version> + <pmd.rules.path>rulesets/pmdRulesets.xml</pmd.rules.path> + + <jxr.version>2.3</jxr.version> </properties> <modules> @@ -347,6 +352,7 @@ <module>plugins</module> <!-- development related modules --> <module>dev</module> + <module>build-tools</module> </modules> <build> @@ -389,14 +395,6 @@ </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-pmd-plugin</artifactId> - <version>3.6</version> - <configuration> - <targetJdk>${thermostat.java.version}</targetJdk> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>2.5</version> </plugin> @@ -510,6 +508,37 @@ </pluginManagement> <plugins> <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-pmd-plugin</artifactId> + <version>${pmd.plugin.version}</version> + <configuration> + <skip>${maven.test.skip}</skip> + <rulesets> + <ruleset>${pmd.rules.path}</ruleset> + </rulesets> + <format>xml</format> + <includeTests>false</includeTests> + <aggregate>true</aggregate> + <printFailingErrors>true</printFailingErrors> + <failOnViolation>true</failOnViolation> + </configuration> + <executions> + <execution> + <goals> + <goal>check</goal> + </goals> + <phase>integration-test</phase> + </execution> + </executions> + <dependencies> + <dependency> + <groupId>com.redhat.thermostat</groupId> + <artifactId>build-tools</artifactId> + <version>1.0</version> + </dependency> + </dependencies> + </plugin> + <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <executions> @@ -583,6 +612,27 @@ </plugin> </plugins> </build> + <reporting> + <plugins> + <!--add maven-jxr-plugin - this is maven-pmd-plugin dependency --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jxr-plugin</artifactId> + <version>${jxr.version}</version> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-pmd-plugin</artifactId> + <version>${pmd.plugin.version}</version> + <configuration> + <skipEmptyReport>true</skipEmptyReport> + <rulesets> + <ruleset>${pmd.rules.path}</ruleset> + </rulesets> + </configuration> + </plugin> + </plugins> + </reporting> <dependencyManagement> <dependencies>