Skip to content

External Configuration File for Spotless Maven Plugin #1805

@NihalJain

Description

@NihalJain

I am currently using the Spotless Maven Plugin in my Java projects to enforce code formatting and have found its features extremely useful in maintaining a clean, consistent codebase.

However, I have found a limitation in the current version of the plugin that I believe could be greatly beneficial if addressed. Currently, there's no direct way to read Spotless configuration from an external XML file in the Spotless Maven Plugin. Configurations for the plugin are currently provided directly within the tag of the pom.xml file of the project.

This can pose a challenge in maintaining consistency of configurations across multiple projects. Although sharing a common parent pom file is an option, it is not always viable, particularly when projects belong to different hierarchies or when complete control over formatting rules is required.

Spotless Maven Plugin could read configuration from a file (local or URL) and treat all other explicit configuration parameters as overrides.

For example we do not have something as shown below:

      <plugin>
        <groupId>com.diffplug.spotless</groupId>
        <artifactId>spotless-maven-plugin</artifactId>
        <version>${spotless.version}</version>
        <configuration>
          <configLocation>checkstyle.xml</configLocation>
        </configuration>
      </plugin>

We could have this similar to how maven-checkstyle-plugin supports this.

Consequently, I would like to propose the addition of a feature for reading the Spotless configuration from an external XML (or properties) file. I believe that this feature will not only enhance the flexibility and control over code formatting rules but also improve the experience of using Spotless in cases where we want to share specific configurations across multiple, separate projects.

I hope you'll consider my proposal for this feature. I am convinced that its inclusion can significantly enhance the plugin's capabilities.

CC: @nedtwigg @lutovich

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions