Use Ant to make you programs (4)

xiaoxiao2021-03-06  105

Summary: Checkstyle_Checks.xml, Java.Header

Now there is already a directory structure, there is build_common.xml, common.xml, usage.txt,

BUILD.XML, Build.properties, etc., you can already complete most of your tasks.

Now explain how to make a secondary task, such as code check.

The code checks in build_common.xml already has this task, but two configurations are required

File cooperation, you need to

Download the CHECKSTYLE JAR package and will

It puts it in a work / common / lib / directory.

These two profiles are: work / common / template / build / directory

Checkstyle_checks.xml file and java.header file

CheckStyle_Checks.xml file Description How should I check on the Java file,

The Java.Header file indicates the head structure of each Java file.

The checkstyle_checks.xml file is as follows.

Johan

The source file made a little modification. The specific instructions for each configuration give a link, do not understand

You can take a closer look.

Copyright 2004 Johan Kng, http://dev.kanngard.net

This Program 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 of the license, OR

ANY LATER VERSION.

This Program 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 this program; if not, Write to the Free Software

Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

->

"- // puppy crawl // DTD Check Configuration 1.2 // en"

"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">

Based on the checkstyle configuration file sun_checks.xml with some minor

Modifications ..

CHECKSTYLE IS VERY CONFIGURBLE. Be Sure To Read The Documentation AT

http://checkstyle.sf.net

->

"- to have access to ant profmentness. in this case->

Name = "Headerfile"

Value = "$ {basedir} /build/java.header" />

->

->

->

"- Miscellaneous Other Checks. ->

The following is my Java file head constructor, of course, each team can have its own agreement.

Because the third, 5th, 8 lines change the change of the file, I ignore the inspection of them.

This can be seen from the checkstyle_checks.xml file above.

/ *

* ------------------------------------------------- ------------

* file name: _filename_

* Authors: Camry (Camry@gmail.com)

* Created: _datetime_

* Copyright: (c) 2003 Vitular Inc. All Rights Reserved.

*

* MODIFICATIONS: *

* ------------------------------------------------- ------------

* /

Some friends may feel that every time I write such a head before the document is not very trouble, but for me,

This is very easy to make Vim. When I use Vim to create a Java file,

It will automatically add this header, and replace with the appropriate file name and time _filename_ and

_Datetime_ These two parameters. How to do this will be explained in the future.

There will be such a hassle place when using this CheckStyle: it does not allow excess in the end of the line.

Space. For programmers, who cares about several spaces, but the program is very rigorous :)

Friends using VIM can find how to easily eliminate row spaces here.

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

New Post(0)