No output from Checkstyle in ANT

2019-07-27 04:36发布

I am not using an automated build tool. Just Checkstyle 5.5 and ANT 1.8. I am trying to have Checkstyle run in my ANT script. The ANT script executes without error, but doesn't seem to call Checkstyle. I get no output except ANT reports BUILD SUCCESSFUL. Here is my ant script:

<project name="ccu" xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">

<target name="checkstyle" description="Generates a report of code convention violations.">

<cs:checkstyle config="custom_check.xml">
<fileset dir="src" casesensitive="yes">
  <include name="**/*.java"/>
</fileset>
<!--
  <fileset dir="src" includes="**\*.java"/>
-->
</cs:checkstyle>

</target>
</project>

what am i missing?

1条回答
劳资没心,怎么记你
2楼-- · 2019-07-27 04:54

It was a classpath problem. For some reason I needed to direct the ANT classpath to the class files not the jar. My final script looks like this:

<project name="ccu" xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">

<taskdef resource="checkstyletask.properties">
        <classpath>  
                <pathelement location="C:\myClasses\bin"/>
                <pathelement location="C:\checkstyle-5.5\checkstyle-5.5-all.jar"/>
        </classpath>
</taskdef>

<checkstyle config="custom_check.xml">

  <fileset dir="src" includes="**/*.java"/>

</checkstyle>

</project>
查看更多
登录 后发表回答