Kotlin排除maven中的ktlint目录



我正在尝试删除generate sources目录中的klint错误,否则在exclude中添加一些脚本作为替代

从这里开始,我想我们可以在gradle做这件事https://github.com/JLLeitschuh/ktlint-gradle/issues/97

渐变中的这一特征如下所示

ktlint {
filter {
exclude("**/generated/**")
include("**/kotlin/**")
}
}  

到目前为止,我已经在Maven中尝试过这样做,但它仍然会对一些不可避免的生成源执行linting操作。https://github.com/gantsign/ktlint-maven-plugin/issues/341

<sourcesExcludes>
<sourcesExcludes>directoryToExclude<sourcesExclude>
</sourcesExcludes>

在maven插件中使用以上内容

<plugin>
<groupId>com.github.gantsign.maven</groupId>
<artifactId>ktlint-maven-plugin</artifactId>
<version>1.7.0</version>
<executions>
<execution>
<configuration>
<sourcesExcludes>
<sourcesExclude>**/generated-sources/graphql/com/expediagroup/dataquality/api/utils/**</sourcesExclude>
</sourcesExcludes>
</configuration>
<phase>prepare-package</phase>
<goals>
<goal>format</goal>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>

关于如何排除生成的源目录的任何帮助都将不胜感激。

我在这里找到了解决方案https://github.com/gantsign/ktlint-maven-plugin/issues/341

我们只需要使用以下内容来避免目标文件。

<configuration>
<sourceRoots>${project.build.sourceDirectory}</sourceRoots>
</configuration>

最新更新