ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominique Devienne" <DDevie...@lgc.com>
Subject RE: Checkstyle task
Date Mon, 28 Feb 2005 16:08:05 GMT
> From: Frank W. Zammetti [mailto:fzlists@omnytex.com]
> 
> I'm having a heck of a time trying to get a CheckStyle task up and
> running... I'm using Ant 1.6.2 and CheckStyle 3.4.  Here's what I have
in
> my build.xml:
> 
>   <target name="static_analysis">
>     <echo message="Performing static code analysis..." />
>     <taskdef resource="checkstyletask.properties" />

No classpath here, where it matters.

>     <checkstyle config="docs/sun_checks.xml">
>       <fileset dir="${toa_base_dir}/WEB-INF/classes"
> includes="**/*.java"/>
>       <formatter type="plain" />
>       <formatter type="xml"
> toFile="${toa_base_dir}/source/static_analysis_checkstyle.xml" />
>     </checkstyle>
>     <echo message="Done" />
>   </target>
> 
> I'm trying to run the analysis on all the classes generated by a
previous
> compile step, which was done into a standard webapp directory
structure.
> I'd like the output to go to the console as well as an XML report
file.
> 
> The property toa_base_dir is properly defined.  I know this because
all
> the other tasks in the build work fine using it.
> 
> I'm getting:
> 
> static_analysis:
>      [echo] Performing static code analysis...
>   [taskdef] Could not load definitions from resource
> checkstyletask.properties. It could not be found.
> 
> I have a classpath definition which includes:
> 
>     <pathelement
> location="${toa_base_dir}/source/libutils/checkstyle-all-3.4.jar" />

Where is this path defined?

> I've verified the JAR is there and is spelled accurately here.  There
are
> a number of other JARs in that directory, all of which are added to
the
> path as expected, so I know the basic path construction works.
> 
> I've read that there may or may not be some compatibility issues with
this
> version of CheckStyle and Ant about 1.5, but I haven't found any
actual
> answers to what to do about it.  Can anyone help?  Thanks very much!

Here's an example use. --DD

  <!-- ====================================================
       Inspects source code for Javadocs errors
    -->
  <target name="checkstyle"
          description="Inspects source code for Javadocs errors">

    <taskdef resource="checkstyletask.properties">
      <classpath>
        <fileset dir="${buildtools}/checkstyle" includes="*.jar" />
      </classpath>
    </taskdef>

    <checkstyle config="${buildtools}/config/javadocs-checks.xml"
                failOnViolation="true">
      <fileset dir="src">
        <include name="**/*.java" />
        <exclude name="**/test/**" />
        <exclude name="**/examples/**" />
      </fileset>
    </checkstyle>
    <echo>Checkstyle done without error</echo>

  </target>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message