Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with kotlin 2.0.1 #809

Open
nckdistributable opened this issue Nov 29, 2024 · 4 comments
Open

Error with kotlin 2.0.1 #809

nckdistributable opened this issue Nov 29, 2024 · 4 comments

Comments

@nckdistributable
Copy link

nckdistributable commented Nov 29, 2024

Hi, I'm getting an error when executing the ktlintCheck task. The error is:

Execution failed for task ':runKtlintCheckOverKotlinScripts'.
> A failure occurred while executing org.jlleitschuh.gradle.ktlint.worker.KtLintWorkAction
   > Class org.jetbrains.kotlin.lexer.KtTokens does not have member field 'org.jetbrains.kotlin.lexer.KtModifierKeywordToken HEADER_KEYWORD'

I found that this keyword was removed in the most recent versions of the Kotlin compiler. Is the current version of ktlint aware of this?

Thanks!

@cbartolome
Copy link

This might be about Kotlin 2.1.0, not 2.0.1.

@gmmoreira
Copy link

This error has been fixed in ktlint lib version 1.4.0, but this plugin is using an slightly older version of the lib.

In build.gradle.kts we can configure the plugin to use the most recent version of ktlint.

ktlint {
    version.set("1.4.1")
}

That should fix the error for now.

@JLLeitschuh
Copy link
Owner

A PR updating the default Ktlint version would be appreciated and accepted with a simple unit test and a CHANGELOG entry

@CPColin
Copy link

CPColin commented Dec 9, 2024

I hope this PR is what you were looking for: #818

ben-madley-mt added a commit to ministryofjustice/hmpps-integration-api that referenced this issue Jan 15, 2025
This is to prevent the error with the default version JLLeitschuh/ktlint-gradle#809
probation-integration-bot bot pushed a commit to ministryofjustice/hmpps-integration-api that referenced this issue Jan 15, 2025
* Bump the minor group across 1 directory with 12 updates

Bumps the minor group with 12 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [org.springframework.boot:spring-boot-starter-webflux](https://github.com/spring-projects/spring-boot) | `3.4.0` | `3.4.1` |
| [org.jetbrains.kotlinx:kotlinx-serialization-json](https://github.com/Kotlin/kotlinx.serialization) | `1.7.3` | `1.8.0` |
| [io.sentry:sentry-spring-boot-starter-jakarta](https://github.com/getsentry/sentry-java) | `7.18.0` | `7.20.0` |
| [io.sentry:sentry-logback](https://github.com/getsentry/sentry-java) | `7.18.0` | `7.20.0` |
| [org.springframework.data:spring-data-commons](https://github.com/spring-projects/spring-data-commons) | `3.4.0` | `3.4.1` |
| [uk.gov.justice.service.hmpps:hmpps-sqs-spring-boot-starter](https://github.com/ministryofjustice/hmpps-spring-boot-sqs) | `5.2.0` | `5.2.2` |
| [org.springdoc:springdoc-openapi-starter-webmvc-ui](https://github.com/springdoc/springdoc-openapi) | `2.7.0` | `2.8.3` |
| [org.wiremock:wiremock-standalone](https://github.com/wiremock/wiremock) | `3.9.2` | `3.10.0` |
| [org.mockito:mockito-core](https://github.com/mockito/mockito) | `5.14.2` | `5.15.2` |
| [com.fasterxml.jackson.module:jackson-module-kotlin](https://github.com/FasterXML/jackson-module-kotlin) | `2.18.1` | `2.18.2` |
| uk.gov.justice.hmpps.gradle-spring-boot | `6.1.0` | `6.1.2` |
| [plugin.spring](https://github.com/JetBrains/kotlin) | `2.0.21` | `2.1.0` |



Updates `org.springframework.boot:spring-boot-starter-webflux` from 3.4.0 to 3.4.1
- [Release notes](https://github.com/spring-projects/spring-boot/releases)
- [Commits](spring-projects/spring-boot@v3.4.0...v3.4.1)

Updates `org.jetbrains.kotlinx:kotlinx-serialization-json` from 1.7.3 to 1.8.0
- [Release notes](https://github.com/Kotlin/kotlinx.serialization/releases)
- [Changelog](https://github.com/Kotlin/kotlinx.serialization/blob/master/CHANGELOG.md)
- [Commits](Kotlin/kotlinx.serialization@v1.7.3...v1.8.0)

Updates `io.sentry:sentry-spring-boot-starter-jakarta` from 7.18.0 to 7.20.0
- [Release notes](https://github.com/getsentry/sentry-java/releases)
- [Changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md)
- [Commits](getsentry/sentry-java@7.18.0...7.20.0)

Updates `io.sentry:sentry-logback` from 7.18.0 to 7.20.0
- [Release notes](https://github.com/getsentry/sentry-java/releases)
- [Changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md)
- [Commits](getsentry/sentry-java@7.18.0...7.20.0)

Updates `org.springframework.data:spring-data-commons` from 3.4.0 to 3.4.1
- [Release notes](https://github.com/spring-projects/spring-data-commons/releases)
- [Commits](spring-projects/spring-data-commons@3.4.0...3.4.1)

Updates `uk.gov.justice.service.hmpps:hmpps-sqs-spring-boot-starter` from 5.2.0 to 5.2.2
- [Commits](https://github.com/ministryofjustice/hmpps-spring-boot-sqs/commits)

Updates `org.springdoc:springdoc-openapi-starter-webmvc-ui` from 2.7.0 to 2.8.3
- [Release notes](https://github.com/springdoc/springdoc-openapi/releases)
- [Changelog](https://github.com/springdoc/springdoc-openapi/blob/main/CHANGELOG.md)
- [Commits](springdoc/springdoc-openapi@v2.7.0...v2.8.3)

Updates `org.wiremock:wiremock-standalone` from 3.9.2 to 3.10.0
- [Release notes](https://github.com/wiremock/wiremock/releases)
- [Commits](wiremock/wiremock@3.9.2...3.10.0)

Updates `org.mockito:mockito-core` from 5.14.2 to 5.15.2
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](mockito/mockito@v5.14.2...v5.15.2)

Updates `com.fasterxml.jackson.module:jackson-module-kotlin` from 2.18.1 to 2.18.2
- [Commits](FasterXML/jackson-module-kotlin@jackson-module-kotlin-2.18.1...jackson-module-kotlin-2.18.2)

Updates `uk.gov.justice.hmpps.gradle-spring-boot` from 6.1.0 to 6.1.2

Updates `plugin.spring` from 2.0.21 to 2.1.0
- [Release notes](https://github.com/JetBrains/kotlin/releases)
- [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md)
- [Commits](JetBrains/kotlin@v2.0.21...v2.1.0)

---
updated-dependencies:
- dependency-name: org.springframework.boot:spring-boot-starter-webflux
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor
- dependency-name: org.jetbrains.kotlinx:kotlinx-serialization-json
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor
- dependency-name: io.sentry:sentry-spring-boot-starter-jakarta
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor
- dependency-name: io.sentry:sentry-logback
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor
- dependency-name: org.springframework.data:spring-data-commons
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor
- dependency-name: uk.gov.justice.service.hmpps:hmpps-sqs-spring-boot-starter
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor
- dependency-name: org.springdoc:springdoc-openapi-starter-webmvc-ui
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor
- dependency-name: org.wiremock:wiremock-standalone
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor
- dependency-name: org.mockito:mockito-core
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor
- dependency-name: com.fasterxml.jackson.module:jackson-module-kotlin
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor
- dependency-name: uk.gov.justice.hmpps.gradle-spring-boot
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor
- dependency-name: plugin.spring
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Hardcode version 1.5.0 of ktlint and format

This is to prevent the error with the default version JLLeitschuh/ktlint-gradle#809

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ben Madley <ben.madley@madetech.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants