spotless icon indicating copy to clipboard operation
spotless copied to clipboard

spotless-maven-plugin fails with "No valid license found" when using IntelliJ IDEA Ultimate

Open ozlmulg opened this issue 5 months ago β€’ 6 comments

Hi Spotless team πŸ‘‹

Description:

I'm using the spotless-maven-plugin (version 2.45.0-SNAPSHOT) with the IntelliJ IDEA formatter integration on macOS (I'm using 2.45.0-SNAPSHOT, built locally, since there hasn't been a stable release yet that includes IntelliJ (idea) support for Maven.). My IntelliJ version is:

IntelliJ IDEA 2025.1.1 (Ultimate Edition)

Even though my license is active and the IDE is registered properly (I can use IntelliJ with no issue via GUI), running mvn spotless:check fails with the following error:

> arguments: [/Users/ozlemulag/Applications/IntelliJ IDEA Ultimate.app/Contents/MacOS/idea, format, -s, /Users/ozlemulag/Applications/ozlemulag/Documents/codestyle_settings.xml, -charset, UTF-8, /private/var/...Temp.java]
> exit code: 7
> stdout: No valid license found
> stderr:
> [JRSAppKitAWT markAppIsDaemon] failed. SetApplicationIsDaemon returned -50
> WARN - CommonProxy - main authenticator is not yet registered

Here's my relevant Maven configuration:

<plugin>
  <groupId>com.diffplug.spotless</groupId>
  <artifactId>spotless-maven-plugin</artifactId>
  <version>2.45.0-SNAPSHOT</version>
  <executions>
    <execution>
      <goals>
        <goal>check</goal>
        <goal>apply</goal>
      </goals>
    </execution>
  </executions>
  <configuration>
    <java>
      <includes>
        <include>src/**/*.java</include>
      </includes>
      <idea>
        <codeStyleSettingsPath>/Users/ozlemulag/Documents/codestyle_settings.xml</codeStyleSettingsPath>
        <withDefaults>false</withDefaults>
        <binaryPath>/Users/ozlemulag/Applications/IntelliJ IDEA Ultimate.app/Contents/MacOS/idea</binaryPath>
      </idea>
    </java>
  </configuration>
</plugin>

Additional Notes: If I run the formatter manually using format.sh like this:

find -name "*.java" -print0 | xargs -0 /Users/ozlemulag/Applications/IntelliJ\ IDEA\ Ultimate.app/Contents/bin/format.sh -s /Users/ozlemulag/Documents/codestyle_settings.xml

…then everything works fine. Formatting is applied successfully to all files.

It seems that when Spotless invokes IntelliJ, it is unable to detect the active license.

Question: Is this a known limitation? Is there a way to allow Spotless to access the IntelliJ license when running via Maven/CLI?

Thanks a lot in advance πŸ™ Let me know if you'd like me to try with any debugging flags or extra settings.

ozlmulg avatar Jul 06 '25 18:07 ozlmulg

Thank you for raising this.

In my local tests (using IntelliJ IDEA 2025.1.3 (Ultimate Edition)) I can't reproduce this behavior.

For launching IntelliJ IDEA we create a custom idea.properties file that points to a temporary idea.config.path and idea.system.path: https://github.com/diffplug/spotless/blob/86d65b0f5405d6b9316333828a8d9a692dee9f18/lib/src/main/java/com/diffplug/spotless/generic/IdeaStep.java#L234-L269

My guess is that your license might be stored in one of the standard idea.config.path or idea.system.path locations. Can you check on that?

simschla avatar Jul 07 '25 09:07 simschla

Reference question: https://intellij-support.jetbrains.com/hc/en-us/articles/206544609-How-to-find-the-license-file-or-information-used-by-the-IDE

Myself, I have registered using my JetBrains Account, that's probably why I don't see this issue.

simschla avatar Jul 07 '25 10:07 simschla

Thanks for the explanation @simschla πŸ™

I'm using IntelliJ IDEA Ultimate via JetBrains Toolbox, and based on the Toolbox settings and documentation, my IDE paths appear to be:

~/Library/Application Support/JetBrains/IntelliJIdea2025.1
~/Library/Caches/JetBrains/IntelliJIdea2025.1

ozlmulg avatar Jul 08 '25 15:07 ozlmulg

I'm having the same issue using IDEA license server.

License data is no longer stored in the .key file, Java Registry is used for that instead. It stores the cached auth tokens. Java Registry is inside ~/Library/Preferences/com.apple.java.util.prefs.plist on Mac.

edudar-chwy avatar Jul 14 '25 20:07 edudar-chwy

@edudar-chwy Based on the jetbrains support page linked above, in case of a license server, there should be a .key file:

When using the license server, it's stored in the .key file under the IDE configuration directory.

Can you check if that is the case for you? If so, we might need to allow a path to be specified for this.

@ozlmulg On my machine, I find a idea.key file in ~/Library/Application\ Support/JetBrains/IntelliJIdea2025.1/idea.key - how about your side, do you see that too?

simschla avatar Jul 28 '25 13:07 simschla

@simschla there's an idea.key by that path, but its content is the license server URL and nothing else. Actual token is in the plist and it's getting refreshed every 15-20 minutes or so

Image

edudar-chwy avatar Jul 29 '25 17:07 edudar-chwy