Closed lihaoyi closed 1 month ago
I'd prefer palantir
, either directly or via spotless
, which could provide a lot of other formatters too.
Sure! Maybe it should be via spotless
then?
Let's go with palantir-java-format for now. At a glance Spotless seems a lot more heavyweight, and maybe can come in a follow up, but palantir-java-format should suit the immediate need of "we need a java formatter" and hopefully be easier to implement
I experiemented with it in the past but got some class access issues due to not using the module classloader. So, if you're a Scala dev not so deep into Java, expect some difficulties.
yeah I assume there'll be stumbling blocks but I assume they'll be work-around-able. If it can work in eclipse/intellij/gradle/spotless it should be doable inside Mill; worst come to worst we can run it in a separate subprocess. But that's for whoever picks up the bounty to figure out!
From the maintainer Li Haoyi: I'm putting a 500USD bounty on this issue, payable by bank transfer on a merged PR implementing this.
Palantir-Java-Format is a common Java autoformatter, and we should support it as a
contrib/
module to better support Java projects. We should support all common configuration options to allow usage onJavaModule
s andScalaModule
s (which can contain Java sources). It should broadly work the same way ScalaFmt works for Scala (https://mill-build.org/mill/0.11.12/Scala_Module_Config.html#_reformatting_your_code) This needs to come with a reasonable set of unit tests, docs, and at least one example test that can be included in the documentation.May be able to adapt something from https://github.com/sbt/sbt-java-formatter