项目作者: anilkbachola

项目描述 :
Library to manage static code analysis configuration files
高级语言:
项目地址: git://github.com/anilkbachola/build-tools.git
创建时间: 2017-08-31T15:04:13Z
项目社区:https://github.com/anilkbachola/build-tools

开源协议:

下载


build-tools

Library to manage static code analysis configuration files.
This will help manage organization wide static code analysis rules in a single place and allows
developers to run code analysis during development rather than waiting to be analyzed during build-analyze phase during continuous integration.

Usage:
Use in maven project along with a maven profile to run the code analysis.

  1. Setup a maven profile and add the library as a dependency to static code analysis plugins.
    Its best to setup the profiles at a parent project pom.xml so that all the modules and sub-modules will be analyzed.
  1. <profiles>
  2. <profile>
  3. <id>analyze</id>
  4. <build>
  5. <plugins>
  6. <!-- sca: checkstyle plugin -->
  7. <plugin>
  8. <groupId>org.apache.maven.plugins</groupId>
  9. <artifactId>maven-checkstyle-plugin</artifactId>
  10. <version>${plugin.checkstyle.version}</version>
  11. <dependencies>
  12. <dependency>
  13. <groupId>com.risenture.rise.tools</groupId>
  14. <artifactId>build-tools</artifactId>
  15. <version>${rise.buildtools.version}</version>
  16. </dependency>
  17. </dependencies>
  18. <executions>
  19. <execution>
  20. <phase>validate</phase>
  21. <configuration>
  22. <configLocation>chekstyle/chekstyle.xml</configLocation>
  23. <encoding>UTF-8</encoding>
  24. <consoleOutput>true</consoleOutput>
  25. <failOnViolation>true</failOnViolation>
  26. <failsOnError>true</failsOnError>
  27. </configuration>
  28. <goals>
  29. <goal>check</goal>
  30. </goals>
  31. </execution>
  32. </executions>
  33. </plugin>
  34. <!-- sca: findbugs plugin -->
  35. <plugin>
  36. <groupId>org.codehaus.mojo</groupId>
  37. <artifactId>findbugs-maven-plugin</artifactId>
  38. <version>${plugin.findbugs.version}</version>
  39. <configuration>
  40. <xmlOutput>true</xmlOutput>
  41. <effort>MAX</effort>
  42. <threshold>LOW</threshold>
  43. <excludeFilterFile>findbugs/findbugs-exclude.xml</excludeFilterFile>
  44. <failOnError>true</failOnError>
  45. </configuration>
  46. <dependencies>
  47. <dependency>
  48. <groupId>com.risenture.rise.tools</groupId>
  49. <artifactId>build-tools</artifactId>
  50. <version>${rise.buildtools.version}</version>
  51. </dependency>
  52. </dependencies>
  53. <executions>
  54. <execution>
  55. <phase>validate</phase>
  56. <goals>
  57. <goal>check</goal>
  58. </goals>
  59. </execution>
  60. </executions>
  61. </plugin>
  62. <!-- sca: pmd plugin -->
  63. <plugin>
  64. <groupId>org.apache.maven.plugins</groupId>
  65. <artifactId>maven-pmd-plugin</artifactId>
  66. <version>${plugin.pmd.version}</version>
  67. <configuration>
  68. <linkXRef>true</linkXRef>
  69. <sourceEncoding>UTF-8</sourceEncoding>
  70. <minimumTokens>100</minimumTokens>
  71. <skipEmptyReport>false</skipEmptyReport>
  72. <targetJdk>${java.version}</targetJdk>
  73. <rulesets>
  74. <ruleset>pmd/pmd-rules.xml</ruleset>
  75. </rulesets>
  76. </configuration>
  77. <executions>
  78. <execution>
  79. <phase>validate</phase>
  80. <goals>
  81. <goal>check</goal>
  82. <goal>cpd-check</goal>
  83. </goals>
  84. </execution>
  85. </executions>
  86. </plugin>
  87. <!-- Javadocs -->
  88. <plugin>
  89. <groupId>org.apache.maven.plugins</groupId>
  90. <artifactId>maven-javadoc-plugin</artifactId>
  91. <version>${plugin.javadoc.version}</version>
  92. <configuration>
  93. <additionalparam>-Xdoclint:none</additionalparam>
  94. <failOnError>true</failOnError>
  95. </configuration>
  96. <executions>
  97. <execution>
  98. <id>attach-javadocs</id>
  99. <goals>
  100. <goal>jar</goal>
  101. </goals>
  102. </execution>
  103. </executions>
  104. </plugin>
  105. </plugins>
  106. </build>
  107. </profile>
  108. </profiles>
  1. 2. Once the profile is run and activated, individual reports get generated in the target folder