无缘无故地我能够理解我的gradle ktlintCheck
命令不再产生任何问题并且:ktlintFormat
没有修复任何东西。一旦我推送我的更改并且我的 CI 管道开始构建我的 Docker Image 构建过程, ktlint 就会再次工作。
所以要清楚 - 我有问题并且ktlintCheck
没有找到它们。
我所做的唯一真正的增量是将Kotlin 更新1.4.10
为. 我认为这与此有关,但无法弄清楚是什么。ktlint
9.4.0
本地
7:57:41 PM: Executing tasks 'clean ktlintCheck'...
> Task :clean
> Task :ktlintMainSourceSetCheck
> Task :ktlintTestSourceSetCheck
> Task :ktlintKotlinScriptCheck
> Task :ktlintCheck
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.6.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 1s
4 actionable tasks: 4 executed
7:57:42 PM: Tasks execution finished 'clean ktlintCheck'.
CI 管道
Step #0 - "Build": Starting a Gradle Daemon (subsequent builds will be faster)
Step #0 - "Build": > Task :clean UP-TO-DATE
Step #0 - "Build": > Task :compileKotlin
Step #0 - "Build": > Task :compileJava NO-SOURCE
Step #0 - "Build": > Task :processResources
Step #0 - "Build": > Task :classes
Step #0 - "Build": > Task :bootJar
Step #0 - "Build": > Task :inspectClassesForKotlinIC
Step #0 - "Build": > Task :jar SKIPPED
Step #0 - "Build": > Task :assemble
Step #0 - "Build": > Task :ktlintKotlinScriptCheck
Step #0 - "Build": > Task :ktlintMainSourceSetCheck
Step #0 - "Build":
Step #0 - "Build": > Task :ktlintTestSourceSetCheck
Step #0 - "Build": [90m/builder/src/test/kotlin/com/mygame/backend/extension/[0mResolverExtensionTest.kt[90m:[0m39[90m:33:[0m Argument should be on a separate line (unless all arguments can fit a single line)
Step #0 - "Build": [90m/builder/src/test/kotlin/com/mygame/backend/extension/[0mResolverExtensionTest.kt[90m:[0m40[90m:57:[0m Argument should be on a separate line (unless all arguments can fit a single line)
Step #0 - "Build": [91m"plain" report written to /builder/build/reports/ktlint/ktlintTestSourceSetCheck/ktlintTestSourceSetCheck.txt[0m[91m
Step #0 - "Build": [0m
Step #0 - "Build": > Task :ktlintTestSourceSetCheck FAILED
Step #0 - "Build": [91m
Step #0 - "Build": [0m[91mFAILURE: [0m[91mBuild failed with an exception.[0m[91m
Step #0 - "Build": [0m[91m
Step #0 - "Build": [0m[91m* What went wrong:[0m[91m
Step #0 - "Build": [0m[91mExecution failed for task ':ktlintTestSourceSetCheck'.[0m[91m
Step #0 - "Build": [0m[91m> [0m[91mA failure occurred while executing org.jlleitschuh.gradle.ktlint.KtLintWorkAction[0m[91m
摘自 build.gradle.kts
buildscript {
repositories {
maven("https://plugins.gradle.org/m2/")
}
dependencies {
classpath("org.jlleitschuh.gradle:ktlint-gradle:9.3.0")
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.3.3.RELEASE")
}
}
plugins {
id("java")
id("eclipse")
id("idea")
id("org.jlleitschuh.gradle.ktlint") version "9.4.0"
id("org.springframework.boot") version "2.3.3.RELEASE"
id("io.spring.dependency-management") version "1.0.10.RELEASE"
id("com.adarshr.test-logger") version "2.1.0"
kotlin("jvm") version "1.4.10"
kotlin("plugin.spring") version "1.4.10"
}
Dockerfile:
FROM gradle:6.6.1-jdk14 as builder
USER root
WORKDIR /builder
ADD . /builder
RUN gradle clean build
FROM openjdk:14-slim
WORKDIR /app
EXPOSE 8082
COPY --from=builder /builder/build/libs/alemanni-backend.jar app.jar
CMD ["java", "-jar", "app.jar"]
知道为什么它不起作用吗?
编辑:可能与这个问题有关:https ://github.com/JLLeitschuh/ktlint-gradle/issues/399