palantir / palantir-java-format

A modern, lambda-friendly, 120 character Java formatter.
Apache License 2.0
438 stars 46 forks source link

Project import fails with JetBrains Fleet #1071

Open DanielThomas opened 5 months ago

DanielThomas commented 5 months ago

What happened?

When enabling Smart Mode with JetBrains Fleet, projects with this plugin applied fail due to the expectation that the .idea directory will exist:

java.io.FileNotFoundException: /home/coder/Projects/bb/edge/edgezuul/.idea/palantir-java-format.xml (No such file or directory) 
at com.google.common.io.Files.newWriter(Files.java:110) 
at com.palantir.javaformat.gradle.PalantirJavaFormatIdeaPlugin.updateIdeaXmlFile(PalantirJavaFormatIdeaPlugin.java:132) 
at com.palantir.javaformat.gradle.PalantirJavaFormatIdeaPlugin.createOrUpdateIdeaXmlFile(PalantirJavaFormatIdeaPlugin.java:108) 
at com.palantir.javaformat.gradle.PalantirJavaFormatIdeaPlugin.lambda$configureIntelliJImport$8(PalantirJavaFormatIdeaPlugin.java:87)   
at org.gradle.internal.code.DefaultUserCodeApplicationContext$CurrentApplication$1.execute(DefaultUserCodeApplicationContext.java:122)

That's not the case with Fleet, but it is technically an IntelliJ import because that's what the smart mode backend is hosting.

What did you want to happen?

Avoid failing when the .idea directory does not exist. Workaround is to mkdir .idea.