Re: problems running checkstyle from ant

"Oliver Burn" <[email protected]>
Newsgroups gmane.comp.java.audit.checkstyle.user
Message-ID <[email protected]>
In my current project, here is how I declare Checkstyle:

    <path id="checkstyle.classpath">
      <pathelement
          location="build/tools/checkstyle/checkstyle-all-4.3.jar"
          />
    </path>
    <taskdef resource="checkstyletask.properties">
      <classpath refid="checkstyle.classpath"/>
    </taskdef>

And then to invoke it I use:

    <checkstyle config="${config.dir}/checkstyle/checkstyle-rules.xml"
                failOnViolation="false"
                failureProperty="checkstyle.has.failed"
                >
        <!-- detail ommitted -->
    </checkstyle>

I suggest using the *checkstyle-all-4.3.jar* file.

I'd also check that you do not have other copies of Checkstyle in your
classpath. Be sure to check the ANT lib directory.

On Dec 4, 2007 4:25 AM, <[email protected]> wrote:

> Hello everyone,
>
> I'm having troubles running checkstyle 4.3 from an ant task - I've
> followed the description on the checkstyle website, but it fails with
> java.lang.NoClassDefFoundError: org/apache/commons/beanutils/Converter
> exception.
>
> The confusing thing is the classpath printed just before the checkstyle
> task is correct, i.e. it contains all the jar files from
> checkstyle-4.3/lib, the files exist etc. The whole target is defined like
> this:
> ------------------------------------------------------------------------
>
>    <!-- CheckStyle -->
>    <property name="checkstyle.home"
> value="external_resources/checkstyle" />
>    <property name="checkstyle.ant"
> value="${checkstyle.home}/checkstyle-4.3.jar" />
>    <property name="checkstyle.config"
> value="${checkstyle.home}/sun_checks.xml" />
>    <property name="checkstyle.output"
> value="test/output/checkstyle.xml" />
>
>    <path id="checkstyle.classpath">
>      <fileset dir="${checkstyle.home}">
>          <include name="*.jar" />
>        </fileset>
>    </path>
>
>    <!-- checkstyle -->
>    <taskdef resource="checkstyletask.properties"
> classpath="${checkstyle.ant}" />
>    <target name="checkstyle">
>
>      <property name="myclasspath" refid="checkstyle.classpath" />
>      <echo message="${myclasspath}" />
>
>      <checkstyle config="${checkstyle.config}"
> classpathref="checkstyle.classpath">
>
>            <classpath refid="checkstyle.classpath" />
>
>            <!-- what to check -->
>            <fileset dir="${tdstool.src.home}">
>                <include name="**/*.java"/>
>            </fileset>
>
>        </checkstyle>
>
>    </target>
>
> ------------------------------------------------------------------------
>
> Heve you seen such error - maybe it's something trivial or so, but I've
> been debugging this for about two hours without luck.
>
> Thanks for help
> Tomas
>
>
> -------------------------------------------------------------------------
> SF.Net email is sponsored by: The Future of Linux Business White Paper
> from Novell.  From the desktop to the data center, Linux is going
> mainstream.  Let it simplify your IT future.
> http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
> _______________________________________________
> Checkstyle-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/checkstyle-user
>

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4

_______________________________________________
Checkstyle-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/checkstyle-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.