Specify checkstyle suppression in config file.
Backported from OVX
https://review.gerrithub.io/3549
-- description by Marc --
The idea is to have maven and eclipse share the same checkstyle config.
We still setup the suppression, but inside the sun_checks.xml file.
Here we’re using a variable that is standard in Eclipse, but unknown by Maven.
The propertiesLocation allows us to define the variable in the scope of Maven.
See here for more info: http://rolf-engelhard.de/2011/04/using-the-same-suppression-filter-for-checkstyle-in-eclipse-and-maven/
----
Change-Id: I4d1083002db94556d31febdca9fc6d19745a0ce8
diff --git a/conf/checkstyle/checkstyle_maven.properties b/conf/checkstyle/checkstyle_maven.properties
new file mode 100644
index 0000000..4677e08
--- /dev/null
+++ b/conf/checkstyle/checkstyle_maven.properties
@@ -0,0 +1,2 @@
+# See: http://rolf-engelhard.de/2011/04/using-the-same-suppression-filter-for-checkstyle-in-eclipse-and-maven/
+config_loc=conf/checkstyle
diff --git a/conf/checkstyle/sun_checks.xml b/conf/checkstyle/sun_checks.xml
index e318f82..24109ae 100644
--- a/conf/checkstyle/sun_checks.xml
+++ b/conf/checkstyle/sun_checks.xml
@@ -43,6 +43,9 @@
<module name="Checker">
+ <module name="SuppressionFilter">
+ <property name="file" value="${config_loc}/onos_suppressions.xml"/>
+ </module>
<!--
If you set the basedir property below, then all reported file
names will be relative to the specified directory. See
diff --git a/pom.xml b/pom.xml
index a4939ee..2438940 100644
--- a/pom.xml
+++ b/pom.xml
@@ -56,9 +56,7 @@
<version>${checkstyle-plugin.version}</version>
<configuration>
<configLocation>conf/checkstyle/sun_checks.xml</configLocation>
- <suppressionsLocation>
- ${basedir}/conf/checkstyle/onos_suppressions.xml
- </suppressionsLocation>
+ <propertiesLocation>${basedir}/conf/checkstyle/checkstyle_maven.properties</propertiesLocation>
<failsOnError>false</failsOnError>
<logViolationsToConsole>true</logViolationsToConsole>
</configuration>
@@ -418,9 +416,7 @@
- maven-pmd-plugin configuration in pom.xml
(under build and reporting)
-->
- <suppressionsLocation>
- ${basedir}/conf/checkstyle/onos_suppressions.xml
- </suppressionsLocation>
+ <propertiesLocation>${basedir}/conf/checkstyle/checkstyle_maven.properties</propertiesLocation>
</configuration>
<reportSets>
<reportSet>