#529 resource checkstyletask.properties

release_4.4
closed
Oliver Burn
ANT Task (45)
5
2012-10-10
2008-10-09
Marc Beckers
No

I have written a custom check and put it in a jar. When I run the check in NetBeans with the Checkstyle Beans plugin it all works well, but when I run it with Ant I get the following error:

Could not load definitions from resource checkstyletask.properties. It could not be found.
C:\MyData\LocalSubversionWorkingCopy\bla\trunk\projects\BLA\autobuild.xml:43: Problem: failed to create task or type checkstyle
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.

But the file checkstyletask.properties is available in the checkstyle-all-4.4.jar.

What am I doing wrong? Please help me!

Snippet from build.xml:

<target name="checkstyle" depends="init, compile">
<mkdir dir="${build.checkstyle.dir}"/>
<taskdef resource="checkstyletask.properties" classpath="${lib.dir}/autobuild/checkstyle/*.jar"/>
<checkstyle config="${lib.dir}/autobuild/checkstyle/mychecks.xml" failonviolation="false" classpath="${lib.dir}/autobuild/checkstyle/*.jar">
<formatter type="xml" tofile="${build.checkstyle.dir}/checkstyle.xml"/>
<fileset dir="${src.dir}" includes="**/*.java"/>
<classpath path="${build.classes.dir};"/>
</checkstyle>
</target>

Discussion

  • Marc Beckers
    Marc Beckers
    2008-10-10

    I have fixed the problem by adding a path element:


    <fileset dir="${lib.dir}/autobuild/checkstyle">
    <include name="*.jar"/>
    </fileset>

    and changing the taskdef element:

    <taskdef resource="checkstyletask.properties" classpathref="checkstyle.classpath"/>

    Apologizes!