开发者

Configuring Checkstyle (Java) at a shared location

I have a requirement where I want to configure al开发者_开发技巧l rules, suppression, etc. at a shared place and all other users will point to the same location to run the required rules. I have referred to Checkstyle sourceforge site and some other references too, but not able to figure out how. It would be a great help if some pointers are suggested.


It'll largely depend on how you run Checkstyle.

As already mentioned, you can use a build server configured to run Checkstyle—but this has a slight disadvantage that developers will have to check in their code, then wait for the build to kick in before getting any feedback.

On the opposite end, you can use Checkstyle in your IDE, such as Eclipse with the eclipse-cs plugin. The eclipse-cs plugin can be easily configured to use a Checkstyle configuration file on a shared (network) folder, or even on a remote location (a URL).

In our shop, we use Maven + Checkstyle plugin to execute Checkstyle checks as part of the build, whether on the developer's machine or on the CI server. The Checkstyle rules in this case are checked-in as part of the project source (which allows refinement/relaxation of rules on a per project basis). We then configure eclipse-cs to load the "project relative" configuration file and use that. This provides Checkstyle coverage throughout the development, local build/deploy and CI cycle.


Probably the easiest way is to set up a build server and configure your build to run checkstyle as part of the automated build. Then you can configure checkstyle on the build server and monitor it using the build server.

This has the added advantage that developers do not need to run checkstyle as part of their build, as well as ensuring that source code is built from source control (e.g. you'd pick up if a developer has forgotten to check in a file or commit a change).

Jenkins is an easy to setup and use continuous integration system and provides a plugin for checkstyle.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜