First: please keep on the list (as long as you dont want to provide sensible 
data ;)
Other people could be interesting in this problem (and its solution) too.

Second: this is more a CS related question than an Ant one .... but because I 
just had
the same problem two weeks ago, I could provide the solution :-)))

* Create a "checkstyle" directory under your Ant installation ( 
${ant.home}/checkstyle will 
  now point to this)
* Put the checkstyle-all-4.3.jar (containing standard checks), 
checkstyle-optional-4.3.jar
  (containing J2EE checks) and your own checks into that directory.
* Put also your customized rule.xml and the checkstyle.xsl's into that 
directory.

Start Ant with "-lib %ANT_HOME%\checkstyle".
For our own Ant distribution I renamed ant.bat to ant.org.bat and created a new 
ant.bat
in ANT_HOME\bin:
  @echo off
  call %~dp0ant.org.bat -lib %~dp0..\checkstyle %*

So this target should work:
<target name="checkstyle">
    <mkdir dir="${cs.report.dir}"/>
    <cs:checkstyle
        config="${ant.home}/addons/rzf_checks.xml" 
        failOnViolation="false" 
        xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
        <fileset dir="${java.dir}" includes="**/*.java"/>
        <fileset dir="${junit.dir}" includes="**/*.java"/>
        <formatter type="xml" tofile="${cs.report.dir}/checkstyle_report.xml"/>
    </cs:checkstyle>
    <xslt 
       style="${ant.home}/checkstyle/checkstyle-frames.xsl"
       in="${cs.report.dir}/checkstyle_report.xml"
       out="${cs.report.dir}/checkstyle_report.html"
    />
</target>

ant.home  : automatically set by Ant; points to Ant's install location
java.dir  : points to the directory containing the java program sources
junit.dir : points to the directory containing the junit test cases (sources)
cs.report.dir : where to generate the cs-reports into?



Jan


________________________________

        Von: Sameer Borwankar [mailto:[EMAIL PROTECTED] 
        Gesendet: Montag, 30. Juli 2007 12:53
        An: Materne, Jan (RZF)
        Betreff: Re: AW: checkstyle-ant
        
        

        hey Jan,

         

        Thanks for your repl........Actually i am not able to find the 
CS-distro.zip file so can you please tell me from where can i get it.

         

        One more thing when i am trying to run custom checkstyle rules xml file 
called cs-rules.xml then the same script is giving me the error as unable to 
create the checker- unable to read the file - unable to parse configuration 
stream..........also help me regarding the same........



        ----- Original Message ----
        From: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
        To: user@ant.apache.org
        Sent: Monday, July 30, 2007 3:11:51 PM
        Subject: AW: checkstyle-ant
        
        
        <checkstyle> generates a xml based report.
        
        This report should be converted to HTML by the <style> task via XSLT 
transformation. 
        The path to the xsl as you have defined must be "checkstyle.xsl" 
directly under your projects root directory (if you havent specified the 
<project basedir>).
        
        I think you are missing this file. This xsl is part of the CS-distro. 
Have a look into the zip and extract the file to your project (e.g. 
"src/etc/checkstyle.xsl").
        
        
        Jan
        
        >-----Ursprüngliche Nachricht-----
        >Von: Sameer Borwankar [mailto:[EMAIL PROTECTED] 
        >Gesendet: Montag, 30. Juli 2007 11:21
        >An: Ant Users List
        >Betreff: checkstyle-ant
        >
        >Hi all,
        >
        >I am trying to generate a report using checkstyle plugin with IBM RAD.
        >I have written an ant script for the same as follows:
        >    
        >    <target name="checkstyle"
        >        description="Generates a report of code convention 
        >violations.">
        >
        >  <checkstyle config="docs/sun_checks.xml"
        >              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>
        >
        >
        >When i try to run this ant script the error which m getting is 
        >"system cannot find the file checkstyle.xsl" so please help me 
        >regarding the same...
        >
        >Regards,
        >Sameer
        >
        >
        >       
        >_______________________________________________________________
        >_____________________
        >Building a website is a piece of cake. Yahoo! Small Business 
        >gives you all the tools to get online.
        >http://smallbusiness.yahoo.com/webhosting 
        >
        
        ---------------------------------------------------------------------
        To unsubscribe, e-mail: [EMAIL PROTECTED]
        For additional commands, e-mail: [EMAIL PROTECTED]


________________________________

        Get the free Yahoo! toolbar 
<http://us.rd.yahoo.com/evt=48226/*http://new.toolbar.yahoo.com/toolbar/features/norton/index.php>
  and rest assured with the added security of spyware protection. 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to