views:

14

answers:

1

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.

In this checks.xml file, I have

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

This works when I run through maven. However, when I run through eclipse, I need to chang ethe config to be

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

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

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.

thanks, Jeff

A: 

You could try defining ${basedir} as a property in your pom.
See the pom reference quick overview.

<property>
          <name>basedir</name>
          <value>${project.basedir}</value>
</property>
crowne
basedir is already a maven property. I have added a propertyExpansion tag to the maven checkstyle configuration that says <propertyExpansion>basedir=${basedir}</propertyExpansion> and that seems to do the trick. It seems a little odd that I would need to do this though.
Jeff Storey