title: Setup checkstyle as part of java project build process
body: <p>I am working on adding checkstyle to the build process of a java project. The results of the checkstyle will be later displayed on jenkins. I am using java7 &amp; netbeans 7.2.1</p>
  
  <p>For most of the work I am following the instructions on this page: <a href="http://checkstyle.sourceforge.net/anttask.html" rel="nofollow">http://checkstyle.sourceforge.net/anttask.html</a></p>
  
  <p>However, i'm a beginner in java (&amp; jenkins) and some of the instructions do not make sense to me:</p>
  
  <p>1- The doc says: "To use the task in a build file, you will need the following taskdef declaration: ". 
  Question: is this to be added in the build.xml file? or where?</p>
  
  <p>2- Then the doc goes on describing a set of parameters and provides some examples. Are these to be added to build.xml too? or?</p>
  
  <p>3- Checkstyle uses a configuration file. I'll be using the standard sun_checks.xml. Where should this be placed?</p>
  
  <p>If someone can point me out to a step by step tutorial for the whole process, i'd be most grateful.
  Thx in advance for all answers</p>
  
  <p>I am using the following in my build.xml:</p>
  
  <pre><code>&lt;taskdef resource="checkstyletask.properties"
       classpath="libs/checkstyle-5.6-all.jar"/&gt;
  
  &lt;target name="checkstyle"
          description="Generates a report of code convention violations."&gt;
  
      &lt;checkstyle config="sun_checks.xml"
                    failureProperty="checkstyle.failure"
                    failOnViolation="false"&gt;
          &lt;fileset dir="src" includes="**/*.java"/&gt;
          &lt;formatter type="xml" toFile="checkstyle-results.xml"/&gt;
      &lt;/checkstyle&gt;
  
      &lt;style in="checkstyle-results.xml" out="checkstyle_report.html" style="checkstyle.xsl"/&gt;
  
  &lt;/target&gt;
  </code></pre>