Skip to content

An IntelliJ plugin that allows running the spotless Gradle and Maven tasks from within the IDE, either on the current file selected in the editor or for the whole project.

License

Notifications You must be signed in to change notification settings

lipiridi/spotless-applier

Repository files navigation

Spotless Applier

Build Version Downloads

The Spotless Applier IntelliJ Plugin enhances your development workflow by seamlessly integrating Spotless Gradle and Maven tasks directly within the IntelliJ IDE. With this plugin, you can easily apply code formatting and style enforcement to your projects, either for the current file you're working on or for the entire project.

Features

Actions Shortcuts (Windows) Shortcuts (MacOS)
Code > Reformat File With Spotless Ctrl+Alt+; ⌘Сmd+⌥Opt+;
Code > Reformat Project With Spotless Ctrl+Alt+Shift+; ⌘Сmd+⌥Opt+⇧Shift+;

✔️ Supports multi-module projects

Commit check

The plugin also offers a commit check to automatically apply Spotless formatting.

To enable this feature, navigate to Settings > Version Control > Commit and activate Reformat code with Spotless

Settings

To access plugin settings, go to: Settings > Tools > Spotless Applier

  • Allow Gradle cache for 'apply' task > Starting from version 6.0.0, Spotless supports Gradle's configuration cache. If you want to use it, please enable this checkbox.
  • Optimize imports before applying > Enable this option to additionally execute IntelliJ IDEA's default "optimize imports" task before applying Spotless formatting.
    • Prohibit imports with asterisk '*' > Prevents imports with the asterisk symbol during the "optimize imports" task. When enabled, any imports that use the '*' symbol to import all classes from a package will be replaced with FQN.

Media

spotlessdemo image image

Install

Using IDE built-in plugin system:

Settings/Preferences > Plugins > Marketplace > Search for "Spotless Applier" > Install Plugin

Manually:

Download the latest release and install it manually using Settings/Preferences > Plugins > ⚙️ > Install plugin from disk...

How it works

This plugin resolve your current build tool by searching the pom.xml (Maven) or .gradle (Gradle) files in project's root folder. After that, it runs the spotless:apply or spotlessApply task.

For applying changes only for current file it uses:

Acknowledgments

Thanks to Ryan Gurney for his Spotless IntelliJ Gradle plugin which I used as the basis for this plugin.

Contributing

See CONTRIBUTING.md

Release Notes

See CHANGELOG.md

License

See License

About

An IntelliJ plugin that allows running the spotless Gradle and Maven tasks from within the IDE, either on the current file selected in the editor or for the whole project.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages