No output from Checkstyle in ANT

天涯浪子 提交于 2019-12-11 11:18:18

问题


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:


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>


来源:https://stackoverflow.com/questions/9638019/no-output-from-checkstyle-in-ant

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!