Ant + CheckStyle Implementation Code Check

xiaoxiao2021-03-06  15

Ant CheckStyle Implementation Source: BEA Forum Powerise1 Checkstyle Introduction Checkstyle is a tool for developers to write Java code according to some habits, and he implements the automation of code checks, helping people liberate from this cumbersome work. The default provides support for Sun programming specification, but CheckStyle is a highly configurable, you can configure what you need to check according to your own requirements.

2 Tool Download, Installation 2.1 Ant Download the latest version 1.6.1, download address: http: //ant.apache.org/ Unzip to C: /ANT1.6.1, will reference the% ant_home% 2.2 CHESKStyle download latest version 3.3 , Download address: http://checkstyle.sourceforge.net/ Unzip to C: /Checkstyle3.3, will reference to% checkStyle_home% 3 Simple configuration 3.1 Environment variable: set path =% Ant_home% / binset classpath =% checkstyle_home % / checkStyle-all-3.3.jar3.2 build.xml file N Add Taskdef N increase Task Properties Description: Config To use the format configuration file ClassPath To use the JAR file fileset needs to check the file collection 4 Description The content you need to check is Module configuration, so if you don't check those Module, you can remove him, below is the default Sun code specification check configuration file: <

! - Checkstyle configuration that checks the sun coding conventions from: - the Java Language Specification at http://java.sun.com/docs/books/jls/second_edition/html/index.html - the Sun Code Conventions at http: //java.sun.com/docs/codeconv/ - the javadoc guidiness at http://java.sun.com/j2se/javadoc/writingdoccomments/index.html - The JDK API Documentation http://java.sun.com /j2se/docs/api/index.html - some best practices Checkstyle is very configurable Be sure to read the documentation at http://checkstyle.sf.net (or in your downloaded distribution) Most Checks are configurable, be sure.. . to consult the documentation to completely disable a check, just comment it out or delete it from the file Finally, it is worth reading the documentation .--> <-.! Checks that a package .html file exissrs for each package. -> ->

-> <

! - Modifier Checks -> <-! Checks for class design ->

转载请注明原文地址:https://www.9cbs.com/read-46442.html

New Post(0)