Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can Spotless be configured to use e.g. "GoogleJavaFormat 1.21.0 or newer"? #2086

Open
flpa opened this issue Apr 4, 2024 · 0 comments
Open

Comments

@flpa
Copy link

flpa commented Apr 4, 2024

Is it possible to use a "flexible" version for googleJavaFormat, e.g. to tell spotless "use version 1.21.0 or newer"?

Details:

We are currently using spotless like this in our builds:

 <plugin>
        <groupId>com.diffplug.spotless</groupId>
        <artifactId>spotless-maven-plugin</artifactId>
        <version>2.43.0</version>
        <configuration>
          <java>
            <googleJavaFormat>
              <version>1.21.0</version>
              <style>GOOGLE</style>
            </googleJavaFormat>
          </java>
       ...
        </configuration>
      </plugin>

In IntelliJ IDEA, we are using the google-java-format plugin, so that the code style matches between IDE and build. However, IDE plugins offer updates rather often or install them automatically, so we are concerned that the version of GoogleJavaFormat could diverge between IDE and build in the future.
We thought about configuring spotless to automatically pick the latest version of the format according to some version range notation, for example in NPM notation:

            <googleJavaFormat>
              <version>^1.21.0</version>
              <style>GOOGLE</style>
            </googleJavaFormat>

Or in oldschool Maven notation:

            <googleJavaFormat>
              <version>[1.21.0,)</version>
              <style>GOOGLE</style>
            </googleJavaFormat>

We couldn't find anything related in the spotless docs or issue tracker, so we just tried these two notations and they did not work.
Is something like that supported, or a possible feature in the future?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant