1. Code quality Check Tool FindBugs and simian (Baidu Network disk share address). 2. Use ant integration. (Ant primer outer chain). 3. Execute the file. Staticcheck.xml<?xml version= "1.0" encoding= "UTF-8"?><projectname="Staticcheck"default="Check" basedir=".. /"> <propertyname="src"value="${BASEDIR}/SRC"/> <propertyname="Classes"value="${basedir}/webcontent/web-inf/classes"/> <propertyname="Staticcheck.home" value="${basedir}/staticcheck"/> <propertyname="Findbugs.home"value="${staticcheck.home}/findbugs-3.0.0"/> <propertyname="Simian.home"value="${staticcheck.home}/simian-2.3.35"/> <propertyname="Report"value="${staticcheck.home}/report"/> <targetname="Check"depends="FindBugs, Simian"/> <targetname="Compile"> <delete dir="${classes}"/> <mkdirdir="${classes}"/> <javac srcdir="${src}"destdir="${classes}"/> </target> <pathid="Findbugs.lib"> <filesetdir="${findbugs.home}/lib"includes="**/*.jar"/> </path> <!--statement findbugs tasks -- <taskdefname="FindBugs"classname="Edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref="Findbugs.lib"/> <targetname="FindBugs"depends="Compile"> <findbugshome="${findbugs.home}"effort="Max"reportlevel="Low"warningsproperty="true"output="HTML"outputfile="${report}/findbugs-report.html"jvmargs="-xmx1024m"> <!--source code path-- <sourcepathpath="${src}"/> <!--the path to the class that findbugs looks for can be jar, zip, or class-- <classlocation="${classes}"/> </findbugs> </target> <taskdefresource="Simiantask.properties"classpath="${simian.home}/simian-2.3.35.jar"/> <targetname="Simian"> <!--Check for Java repeating 6 lines of code-- <simianthreshold="6"language="Java"> <fileset dir="${src}"includes="**/*.java"/> <formattertype="plain"tofile="${report}/simian-log.txt"/> </simian> </target> </project>
Code quality checker Tools FindBugs and simian (repetition rate)