Skip to content

Latest commit

 

History

History
58 lines (52 loc) · 2.46 KB

README.md

File metadata and controls

58 lines (52 loc) · 2.46 KB

maven-scalastyle-plugin

Welcome to maven-scalastyle-plugin. This project is intended to provide maven plugin support for Scalastyle. For more information about Scalastyle, see https://github.com/scalastyle/scalastyle

Goals Overview

  • scalastyle:check performs a violation check against the scalastyle config file to see if there are any violations. It counts the number of violations found and displays it on the console if verbose is enabled.

Usage

Check scalacheck violation part of build cycle

To Configure the Scalastyle Plugin, you need to the add it in the section of your pom.xml as shown in the sample below, and by default the build will fail if there are any violations of level error found. Default phase of execution is verify. The following is an example of a configuration which would be used in a pom:

    <build>
        <plugins> 
          ...
          <plugin>
            <groupId>org.scalastyle</groupId>
            <artifactId>scalastyle-maven-plugin</artifactId>
            <version>0.8.0</version>
            <configuration>
              <verbose>false</verbose>
              <failOnViolation>true</failOnViolation>
              <includeTestSourceDirectory>true</includeTestSourceDirectory>
              <failOnWarning>false</failOnWarning>
              <sourceDirectory>${project.basedir}/src/main/scala</sourceDirectory>
              <testSourceDirectory>${project.basedir}/src/test/scala</testSourceDirectory>
              <configLocation>${project.basedir}/lib/scalastyle_config.xml</configLocation>
              <testConfigLocation>${project.basedir}/lib/scalastyle_test_config.xml</testConfigLocation>
              <outputFile>${project.basedir}/scalastyle-output.xml</outputFile>
              <outputEncoding>UTF-8</outputEncoding>
            </configuration>
            <executions>
              <execution>
                <goals>
                  <goal>check</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          ...
        </plugins>
    </build>

You can also specify multiple source directories if necessary. Replace the element with :

    <sourceDirectories>
      <dir>${project.basedir}/src/main/scala</dir>
      <dir>${project.basedir}/src/main/generated-scala</dir>
    </sourceDirectories>

and similarly for testSourceDirectory & testSourceDirectories.