From 9a8acc01fdfd4cea9891b0da6e01ff41226900ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20K=C3=BChne?= Date: Sun, 24 Mar 2002 09:05:28 +0000 Subject: [PATCH] added example for failureProperty, contribution from Gray Herter [gray _AT_ fgm _DOT_ com] --- docs/anttask.html | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/docs/anttask.html b/docs/anttask.html index 3e27768dc..319383e7d 100644 --- a/docs/anttask.html +++ b/docs/anttask.html @@ -286,6 +286,40 @@ This task is included in the checkstyle distribution.

</checkstyle> +

Run checkstyle in an automated build and send an email report if style violations are detected

+
+  <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>
+
+
+
+

Copyright © 2001 Oliver Burn. All rights Reserved.