Browse Source

Added static analysis profile to pom.xml

Added pmd, findbug as well as site generation logic to top pom.xml file
Created customized pmd ruleset
Bill Hwang 11 years ago
parent
commit
2e56253293
2 changed files with 89 additions and 0 deletions
  1. 20 0
      dev-tools/pmd/custom.xml
  2. 69 0
      pom.xml

+ 20 - 0
dev-tools/pmd/custom.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<ruleset name="Custom 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>
+  Default ruleset for elasticsearch server project
+  </description>
+  <rule ref="rulesets/java/basic.xml"/>
+  <rule ref="rulesets/java/braces.xml"/>
+  <rule ref="rulesets/java/clone.xml"/>
+  <rule ref="rulesets/java/codesize.xml"/>
+  <rule ref="rulesets/java/coupling.xml">
+     <exclude name="LawOfDemeter" />
+  </rule>
+  <rule ref="rulesets/java/design.xml"/>
+  <rule ref="rulesets/java/unnecessary.xml">
+     <exclude name="UselessParentheses" />
+  </rule>
+</ruleset>

+ 69 - 0
pom.xml

@@ -1286,5 +1286,74 @@
           </plugins>
           </plugins>
         </build>
         </build>
       </profile>
       </profile>
+      <profile>
+        <id>static</id>
+        <activation>
+          <property>
+            <name>tests.static</name>
+            <value>true</value>
+          </property>
+        </activation>
+        <build>
+          <plugins>
+            <plugin>
+              <groupId>org.codehaus.mojo</groupId>
+              <artifactId>findbugs-maven-plugin</artifactId>
+              <version>2.5.3</version>
+            </plugin>
+          </plugins>
+        </build>
+        <reporting>
+          <plugins>
+            <plugin>
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-jxr-plugin</artifactId>
+              <version>2.3</version>
+            </plugin>
+            <plugin>
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-pmd-plugin</artifactId>
+              <version>3.0.1</version>
+              <configuration>
+                <rulesets>
+                  <ruleset>${basedir}/dev-tools/pmd/custom.xml</ruleset>
+                </rulesets>
+                <targetJdk>1.7</targetJdk>
+                <excludes>
+                  <exclude>**/jsr166e/**</exclude>
+                  <exclude>**/jsr166y/**</exclude>
+                  <exclude>**/org/apache/lucene/**</exclude>
+                  <exclude>**/org/apache/elasticsearch/common/Base64.java</exclude>
+                </excludes>
+              </configuration>
+            </plugin>
+            <plugin>
+              <groupId>org.codehaus.mojo</groupId>
+              <artifactId>findbugs-maven-plugin</artifactId>
+              <version>2.5.3</version>
+              <configuration>
+                <xmlOutput>true</xmlOutput>
+                <xmlOutputDirectory>target/site</xmlOutputDirectory>
+                <fork>true</fork>
+                <maxHeap>2048</maxHeap>
+                <timeout>1800000</timeout>
+                <onlyAnalyze>org.elasticsearch.-</onlyAnalyze>
+              </configuration>
+            </plugin>
+            <plugin>
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-project-info-reports-plugin</artifactId>
+              <version>2.7</version>
+              <reportSets>
+                <reportSet>
+                  <reports>
+                    <report>dependencies</report>
+                  </reports>
+                </reportSet>
+              </reportSets>
+            </plugin>
+          </plugins>
+        </reporting>
+      </profile>
     </profiles>
     </profiles>
 </project>
 </project>