简体   繁体   English

在自动 eclipse 构建期间使用带有 Ant 的 checkstyle

[英]Using checkstyle with Ant during an automated eclipse build

For the last months I've been slowly improved the Eclipse automated PDE build process for our application.在过去的几个月里,我一直在为我们的应用程序慢慢改进 Eclipse 自动 PDE 构建过程。

The first thing I tried was automating the test cases.我尝试的第一件事是自动化测试用例。 The next step was some scripting code to generate an installer automatically, for both linux and windows .下一步是为linuxwindows自动生成安装程序的一些脚本代码。

Now I want to add some static code analysis reports to the process.现在我想在进程中添加一些static代码分析报告。 In my company we use Checkstyle for this purpose.在我的公司,我们为此使用 Checkstyle。

I understand that it is possible to automate the Checkstyle plugin in such a way that it can generate a report from the build process.我知道可以自动化 Checkstyle 插件,使其可以从构建过程生成报告。 It would be useful to distribute the checkstyle results together with the unit test report, which are being generated already.将 checkstyle 结果与已经生成的单元测试报告一起分发会很有用。

Does anyone has some good example of how this can be achieved in a relatively painless way?有没有人有一些很好的例子来说明如何以相对轻松的方式实现这一目标?

There's a Checkstyle Ant Task defined in the Checkstyle JAR file. Checkstyle JAR 文件中定义了Checkstyle Ant 任务 Use it as follows:按如下方式使用它:

<taskdef resource="checkstyletask.properties" classpath="/path/to/checkstyle-all-4.4.jar"/> 

<checkstyle config="/path/to/my/checkstyle_config.xml">
  <fileset dir="src/checkstyle" includes="**/*.java"/>
</checkstyle>

You might want to look at a CI server like Hudson , which you can use to automate your builds and with which you can easily integrate a number of plugins for FindBugs , CheckStyle, etc.你可能想看看像Hudson这样的 CI 服务器,你可以用它来自动化你的构建,并且你可以很容易地集成一些用于FindBugs 、CheckStyle 等的插件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM