added example for failureProperty, contribution from Gray Herter [gray _AT_ fgm _DOT_ com]
This commit is contained in:
parent
50d5a434f1
commit
9a8acc01fd
|
|
@ -286,6 +286,40 @@ This task is included in the checkstyle distribution.</p>
|
|||
</checkstyle>
|
||||
</pre>
|
||||
|
||||
<p><b>Run checkstyle in an automated build and send an email report if style violations are detected</b></p>
|
||||
<pre>
|
||||
<target name="checkstyle"
|
||||
description="Generates a report of code convention violations.">
|
||||
|
||||
<checkstyle failureProperty="checkstyle.failure"
|
||||
failOnViolation="false">
|
||||
<formatter type="xml" tofile="checkstyle_report.xml"/>
|
||||
<fileset dir="src" includes="**/*.java"/>
|
||||
</checkstyle>
|
||||
|
||||
<style in="checkstyle_report.xml" out="checkstyle_report.html" style="checkstyle.xsl"/>
|
||||
|
||||
</target>
|
||||
|
||||
<!-- run this target as part of automated build -->
|
||||
<target name="checkstyle-nightly"
|
||||
depends="checkstyle"
|
||||
if="checkstyle.failure"
|
||||
description="Sends email if checkstyle detected code conventions violations.">
|
||||
|
||||
<!-- use your own server and email addresses below. See Ant documentation for details -->
|
||||
|
||||
<mail from="qa@some.domain"
|
||||
tolist="someone@some.domain,someoneelse@some.domain"
|
||||
mailhost="mailbox.some.domain"
|
||||
subject="Checkstyle violation(s) in project ${ant.project.name}"
|
||||
files="checkstyle_report.html"/>
|
||||
|
||||
</target>
|
||||
|
||||
|
||||
</pre>
|
||||
|
||||
<hr>
|
||||
<p align="center">Copyright © 2001 Oliver Burn. All rights Reserved.</p>
|
||||
</body>
|
||||
|
|
|
|||
Loading…
Reference in New Issue