ANT 中的 Checkstyle 没有输出 [英] No output from Checkstyle in ANT

查看:32
本文介绍了ANT 中的 Checkstyle 没有输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我没有使用自动构建工具.只是 Checkstyle 5.5 和 ANT 1.8.我正在尝试在我的 ANT 脚本中运行 Checkstyle.ANT 脚本执行没有错误,但似乎没有调用 Checkstyle.除了 ANT 报告 BUILD SUCCESSFUL 之外,我没有得到任何输出.这是我的蚂蚁脚本:

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>

我错过了什么?

推荐答案

这是一个类路径问题.出于某种原因,我需要将 ANT 类路径指向类文件而不是 jar.我的最终脚本如下所示:

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>

这篇关于ANT 中的 Checkstyle 没有输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆