开发者

How do I make the Eclipse Checkstyle plugin and the Maven Checkstyle plugin use the same rules?

开发者 https://www.devze.com 2023-03-14 10:02 出处:网络
I\'d like the Checkstyle rules in Eclipse match the rules when my Maven build runs on Jenkins. How do I go a开发者_StackOverflow社区bout that?

I'd like the Checkstyle rules in Eclipse match the rules when my Maven build runs on Jenkins.

How do I go a开发者_StackOverflow社区bout that?

Thanks.

[edit]

So I exported the checkstyle settings in eclipse to a new XML file in the project folder and pointed the maven checkstyle plugin at that with

<plugin>
 <artifactId>maven-checkstyle-plugin</artifactId>
 <version>2.6</version>
 <configuration>
    <configLocation>checkstyle.xml</configLocation>
 </configuration>
</plugin>


You will have to export your eclipse checkstyle settings into a file and configure your Jenkin (/Hudson) checkstyle plugin to use the same configuration file.


I did it as followed: I have a separate maven build project that contains checkstyle/pmd and others stuff (rule sets) on the classpath. Add this project as dependency in the checkstyle/pmd plugin configuration in your pom, and it will work in maven and in jenkins/hudson if you simple call the maven checkstyle/pmd goal. Works like a charm.

0

精彩评论

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