maven eclipse checkstyle插件 [英] maven eclipse checkstyle plugin

查看:199
本文介绍了maven eclipse checkstyle插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有自定义checkstyle检查文件(称为checks.xml),我试图在maven和eclipse中使用相同的文件。一切都很好,除了 SuppressionFilter

I have custom checkstyle checks file (called checks.xml), and I'm trying to use that same file in both maven and eclipse. It all works well, except for the SuppressionFilter.

在这个checks.xml文件中,我有

In this checks.xml file, I have

<module name="SuppressionFilter">
    <property name="file" value="src/main/resources/checkstyle/checkstyle-suppressions.xml"/>    
</module>

当我运行maven时,这可以工作。但是,当我遇到eclipse时,我需要将配置更改为

This works when I run through maven. However, when I run through eclipse, I need to change the config to be

<module name="SuppressionFilter">
    <property name="file" value="${basedir}/src/main/resources/checkstyle/checkstyle-suppressions.xml"/>    
</module>

如果我用$ {basedir}属性与maven一起运行,我会收到该属性$ {basedir}尚未设置。

If I run with the ${basedir} property with maven though, I get the error that property ${basedir} has not been set.

有没有办法在maven和eclipse中使用相同的配置文件?我觉得应该有,但我只是想知道如何正确填充抑制过滤器。

Is there a way use this same configuration file in both maven and eclipse? I feel like there should be, but I'm just missing something on how to properly populate the suppression filter.

谢谢,
Jeff

thanks, Jeff

推荐答案

当然有一种方法可以在maven和eclipse中使用相同的配置文件,但首先需要一些安装。我写了一篇关于如何实现这个甚至是一个多模块的maven项目的博文。请参阅: maven-checkstyle-and-eclipse

Sure there is a way to use the same configuration file in both maven and eclipse but it requires a little setup first. I wrote a blog post on how to achieve this even for a multi-module maven project. see: maven-checkstyle-and-eclipse

这篇关于maven eclipse checkstyle插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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