Scala FMT Maven Plugin (Not official)

Wrapper for official ScalaFMT formatter to use in Maven

License

License

Categories

Categories

Scala Languages
GroupId

GroupId

com.devsmobile
ArtifactId

ArtifactId

mvn-scalafmt
Last Version

Last Version

0.2.11
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

Scala FMT Maven Plugin (Not official)
Wrapper for official ScalaFMT formatter to use in Maven
Project URL

Project URL

https://github.com/pianista215/mvn_scalafmt/
Source Code Management

Source Code Management

https://github.com/pianista215/mvn_scalafmt

Download mvn-scalafmt

How to add to project

<plugin>
    <groupId>com.devsmobile</groupId>
    <artifactId>mvn-scalafmt</artifactId>
    <version>0.2.11</version>
</plugin>

Dependencies

compile (1)

Group / Artifact Type Version
org.apache.maven : maven-plugin-api jar 3.3.9

provided (1)

Group / Artifact Type Version
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.4

test (1)

Group / Artifact Type Version
junit : junit jar 3.8.1

Project Modules

There are no modules declared in this project.

Synopsis

This is a wrapper that allows you to use the Scalafmt formatter in Mvn. Current version of the embedded Scalafmt is 0.2.11

Usage

There are two goals by default you can use: verify and format. Verify will launch as default scalafmt with --test -f . through your maven projects. Format will launch as default scalafmt with -i -f . through your maven projects.

To include it into your pom.xml, just specify some lines as below in the phase you want to format/verify your code:

<plugin>
  <groupId>com.devsmobile</groupId>
  <artifactId>mvn-scalafmt</artifactId>
  <version>0.2.11</version>
  <executions>
    <execution>
      <phase>validate</phase>
      <goals>
        <goal>format</goal>
      </goals>
    </execution>
  </executions>
</plugin>

Or

<plugin>
  <groupId>com.devsmobile</groupId>
  <artifactId>mvn-scalafmt</artifactId>
  <version>0.2.11</version>
  <executions>
    <execution>
      <phase>validate</phase>
      <goals>
        <goal>verify</goal>
      </goals>
    </execution>
  </executions>
</plugin>

Additional parameters

If you want to change the default parameters for the format/verify goals, you can provide it in the following properties:

<plugin>
  <groupId>com.devsmobile</groupId>
  <artifactId>mvn-scalafmt</artifactId>
  <version>0.2.11</version>
  <configuration>
    <formatParameters>--maxColumn 110 -i -f .</formatParameters>
    <verifyParameters>--test --maxColumn 110 -f .</verifyParameters>
  </configuration>
  <executions>
    <execution>
      <phase>validate</phase>
      <goals>
        <goal>format</goal>
        <goal>verify</goal>
      </goals>
    </execution>
  </executions>
</plugin>

##Debug If you are finding an strange behaviour with the plugin you can check the exit from scalafmt using -X mvn option which provides Debug log. Also you can remove from your ~/.scalafmt the jar that is copied in order to use the plugin from maven.

##Limitations For now only Linux/Unix is provided. I'm looking to extend it to Windows.

Versions

Version
0.2.11