制作Maven Spotless插件格式Kotlin源码
Make Maven Spotless plugin format Kotlin source code
如何获取 Spotless Maven 插件来格式化所有 Kotlin 源文件?
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<executions>
<execution>
<id>spotless-apply</id>
<phase>compile</phase>
<configuration>
<kotlin>
<ktlint/>
</kotlin>
</configuration>
<goals>
<goal>apply</goal>
</goals>
</execution>
</executions>
</plugin>
不确定为什么您当前的配置不起作用,也许是因为配置在执行块内?如果将其上移一级,然后将 apply
替换为 check
,它将起作用。
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<configuration>
<kotlin>
<ktlint />
</kotlin>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
如何获取 Spotless Maven 插件来格式化所有 Kotlin 源文件?
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<executions>
<execution>
<id>spotless-apply</id>
<phase>compile</phase>
<configuration>
<kotlin>
<ktlint/>
</kotlin>
</configuration>
<goals>
<goal>apply</goal>
</goals>
</execution>
</executions>
</plugin>
不确定为什么您当前的配置不起作用,也许是因为配置在执行块内?如果将其上移一级,然后将 apply
替换为 check
,它将起作用。
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<configuration>
<kotlin>
<ktlint />
</kotlin>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>