speedy-spotless-maven-plugin

For easy formatting of staged changes.

License

License

Categories

Categories

Maven Build Tools
GroupId

GroupId

io.committed
ArtifactId

ArtifactId

speedy-spotless-maven-plugin
Last Version

Last Version

0.1.3
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

speedy-spotless-maven-plugin
For easy formatting of staged changes.
Project URL

Project URL

http://github.com/commitd/speedy-spotless
Source Code Management

Source Code Management

http://github.com/commitd/speedy-spotless

Download speedy-spotless-maven-plugin

How to add to project

<plugin>
    <groupId>io.committed</groupId>
    <artifactId>speedy-spotless-maven-plugin</artifactId>
    <version>0.1.3</version>
</plugin>

Dependencies

compile (7)

Group / Artifact Type Version
com.diffplug.spotless : spotless-maven-plugin jar 2.5.0
com.diffplug.spotless : spotless-lib jar 2.9.0
org.eclipse.jgit : org.eclipse.jgit jar 5.8.0.202006091008-r
org.apache.maven : maven-plugin-api jar 3.6.3
org.apache.maven : maven-project jar 2.2.1
commons-io : commons-io jar 2.8.0
org.apache.commons : commons-lang3 jar 3.11

provided (1)

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

test (1)

Group / Artifact Type Version
junit : junit jar 4.13.1

Project Modules

There are no modules declared in this project.

Speedy Spotless

For easy formatting of staged changes. Inspired by pretty-quick.

It includes apply and check goals from Spotless Maven Plugin but also includes the new goal staged to trigger the formatting of files staged in Git.

Works with Java 8+.

Installation

Speedy Spotless supports the exact same configuration options as Spotless Maven Plugin.

Additionally the install-hooks goal may be used to install a pre-commit Git hook to format staged files when committing.

<build>
    <plugins>
      <plugin>
        <groupId>io.committed</groupId>
        <artifactId>speedy-spotless-maven-plugin</artifactId>
        <version>0.1.1</version>
        <executions>
          <execution>
            <id>install-formatter-hook</id>
            <goals>
              <goal>install-hooks</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <java>
            <googleJavaFormat>
              <style>GOOGLE</style>
            </googleJavaFormat>
            <removeUnusedImports />
          </java>
        </configuration>
      </plugin>
    </plugins>
</build>

Ensure the install-hooks goal is declared in your root POM.

Configuration

See Spotless Maven Plugin for code formatting options.

Caveats

  • Currently only Java files are formatted. Spotless's spotlessFiles option is ignored.

Building

# Building the maven plugin
mvn clean package

# Installing the maven plugin
mvn clean install -DskipTests

Deploying to Maven Central

# Required on macOS
GPG_TTY=$(tty)
export GPG_TTY

# Setup GPG, maven settings.xml

mvn clean deploy -P release
io.committed

Committed

Versions

Version
0.1.3
0.1.2
0.1.1
0.1.0
0.0.3
0.0.2