Checkstyle not generating reports with Maven, but showing issues while in Eclipse any hints? -
checkstyle.xml
looks
<property name="severity" value="warning"/> <property name="fileextensions" value="java, properties, xml"/> <module name="treewalker"> <property name="tabwidth" value="4"/> <module name="javadocmethod"> <property name="scope" value="public"/> <property name="allowmissingparamtags" value="true"/> <property name="allowmissingthrowstags" value="true"/> <property name="allowmissingreturntag" value="true"/> <property name="minlinecount" value="2"/> <property name="allowedannotations" value="override, test"/> <property name="allowthrowstagsforsubclasses" value="true"/> </module> <module name="javadocvariable"> <property name="scope" value="protected"/> </module> <module name="avoidstarimport"/> </module>
pom.xml
looks like
<?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>my-group</groupid> <artifactid>my-tests</artifactid> <version>0.0.1-snapshot</version> <name>my-tests</name> <description>my-tests</description> <properties> <checkstyle.config.location>checkstyle.xml</checkstyle.config.location> </properties> <profiles> <profile> <id>checkstyle-profile</id> <build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-checkstyle-plugin</artifactid> <version>2.17</version> <configuration> <configlocation>checkstyle.xml</configlocation> </configuration> <executions> <execution> <id>checkstyle-check</id> <goals> <goal>check</goal> </goals> <phase>test</phase> </execution> </executions> </plugin> </plugins> </build> </profile> </profiles> <dependencies> <dependency> <groupid>org.testng</groupid> <artifactid>testng</artifactid> <version>6.8.8</version> </dependency> <dependency> <groupid>com.googlecode.json-simple</groupid> <artifactid>json-simple</artifactid> <version>1.1</version> </dependency> <dependency> <groupid>com.google.code.gson</groupid> <artifactid>gson</artifactid> <version>2.3.1</version> </dependency> </dependencies> <reporting> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-checkstyle-plugin</artifactid> <version>2.17</version> <configuration> <configlocation>checkstyle.xml</configlocation> </configuration> <reportsets> <reportset> <reports> <report>checkstyle</report> </reports> </reportset> </reportsets> </plugin> </plugins> </reporting> </project>
if run checkstyle in eclipse, shows me errors. on command line, checkstyle report not not generated. how can fix this?
by default maven checkstyle plugin reports violations on error
level. in checkstyle.xml
have declared checks report problems on warning
level , that's why don't see output.
you can either declare severity of checks error
in checkstyle.xml
:
<property name="severity" value="warning"/>
or change violationseverity in pom.xml
:
<configuration> <violationseverity>warning</violationseverity> <configlocation>checkstyle.xml</configlocation> </configuration>
Comments
Post a Comment