Pregunta

I am using Maven an Checkstyle to check my code for quality. Though there are things I'd like to turn off in CheckStyle.

There is a module taking care on trailing spaces. The comment it gives is:

Line has trailing spaces.

Now I assume the module taking care on that is called RegexpSingleline and I'd like to turn it off. I already tried by uncommenting the file in ./myproject/target/checkstyle-checker.xml, but when I run mvn site this file is automatically generated again and my changes in it vanish.

How would I turn this moule off?

¿Fue útil?

Solución

You should make a copy of the checkstyle-checker.xml document and store it outside /target (as this directory will be overridden in the build!). Then, in your pom.xml you can specify this location in the checkstyle plugin configuration (see: http://maven.apache.org/plugins/maven-checkstyle-plugin/examples/custom-checker-config.html)

<project>
  ...
  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>..your version of the plugin..</version>
        <configuration>
          <configLocation>..your location../checkstyle-checker.xml</configLocation>
        </configuration>
      </plugin>
    </plugins>
  </reporting>
  ...
</project>
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top