Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/simonjpegg/mvn_scalafmt

Scalafmt plugin for maven
https://github.com/simonjpegg/mvn_scalafmt

maven maven-plugin pom scala scalafmt

Last synced: 3 days ago
JSON representation

Scalafmt plugin for maven

Awesome Lists containing this project

README

        

[![licenseimg]][licenselink] [![Codacy][codacyimg]][codacylink] ![Coverage][covimg] ![Build Status][buildimg] [![Total alerts][lgtmimg]][lgtmlink]

[![releasebadge]][releaselink] [![Maven][mavenimg]][mavenlink]

## Synopsis

A wrapper that allows the use of the [Scalafmt](https://github.com/scalameta/scalafmt/) formatter in Maven.

## Usage

Add the following snippet to your pom, and it will be invoked as part of your build during the
selected lifecycle phase (default `validate`).

Note: `version.scala.binary` refers to major releases of scala ie. 2.11, 2.12 or 2.13.
mvn_scalafmt_2.11 will soon be deprecated and may not receive future releases

You can also invoke the plugin directly via `mvn scalafmt:format`.

## Versioning

This plugin follows the following versioning convention:

`mvn_scalafmt_(scalaversion)-(major).(minor).(commitepoch).(commithash)`

The latest release should be visible at the top of this readme.

## Minimal Working POM XML:
```xml

org.antipathy

mvn-scalafmt_${version.scala.binary}

__DESIRED_MVN_SCALAFMT_VERSION__

${project.basedir}/.scalafmt.conf



validate

format




```

## FULL SNIPPET
```xml

org.antipathy

mvn-scalafmt_${version.scala.binary}

__DESIRED_MVN_SCALAFMT_VERSION__

${project.basedir}/.scalafmt.conf
false
false

${project.basedir}/src/main/scala


${project.basedir}/src/test/scala

false
true
false

: git rev-parse --abbrev-ref HEAD

false



validate

format


```

`configLocation` Can either be a local path (e.g. `${project.basedir}/.scalafmt.conf`) or a HTTP url (e.g `https://raw.githubusercontent.com/jozic/scalafmt-config/master/.scalafmt.conf`)

make sure you have set a version in your scalafmt.conf
```yaml
version = "2.6.2"
```
[lgtmimg]: https://img.shields.io/lgtm/alerts/g/SimonJPegg/mvn_scalafmt.svg?logo=lgtm&logoWidth=18
[lgtmlink]: https://lgtm.com/projects/g/SimonJPegg/mvn_scalafmt/alerts/
[licenseimg]: https://img.shields.io/badge/Licence-Apache%202.0-blue.svg
[licenselink]: ./LICENSE
[buildimg]: https://github.com/SimonJPegg/mvn_scalafmt/workflows/Build213/badge.svg
[covimg]: https://app.codacy.com/project/badge/Coverage/f7d89aaf1a05436b86043168b7b26715
[codacyimg]: https://app.codacy.com/project/badge/Grade/f7d89aaf1a05436b86043168b7b26715
[codacylink]: https://www.codacy.com/gh/SimonJPegg/mvn_scalafmt/dashboard?utm_source=github.com&utm_medium=referral&utm_content=SimonJPegg/mvn_scalafmt&utm_campaign=Badge_Grade
[mavenimg]: https://maven-badges.herokuapp.com/maven-central/org.antipathy/mvn-scalafmt_2.11/badge.svg
[mavenlink]: https://search.maven.org/search?q=org.antipathy.mvn-scalafmt
[releasebadge]: https://img.shields.io/github/release/simonjpegg/mvn_scalafmt.svg?style=flat
[releaselink]: https://github.com/SimonJPegg/mvn_scalafmt/releases