gradle icon indicating copy to clipboard operation
gradle copied to clipboard

grade init built in Maven converter uses keywords in Kotlin scripts when creating version catalog

Open pawelkw opened this issue 1 year ago • 1 comments

Current Behavior

When using gradle init to convert a Maven project to Gradle and dependencies contain Kotlin keywords they are used in the generated version catalog causing the build to fail due to incorrect syntax in the build.gradle.kts file.


* Where:
Build file '/Users/xyz/abc/sample/build.gradle.kts' line: 27

* What went wrong:
Script compilation errors:

  Line 27:     api(libs.my.library.string.interface)
                                                                            ^ Name expected

  Line 32:     testImplementation(libs.org.jetbrains.kotlin.kotlin.test)
                                                                        ^ Expecting ')'

2 errors

Expected Behavior

If maven dependencies contain Kotlin keywords they are not used in the generated version catalog. i.e. interface

Context (optional)

No response

Steps to Reproduce

  1. Have a Java Maven project
  2. One of the POM dependency names should end -interface. i.e.:
<artifactId>string-interface</artifactId>
  1. Use gradle init
  2. Chose to convert from Maven, chose Kotlin, say "no" to using new features
  3. Run ./gradlew in newly created Gradle project

Observe the error:


* Where:
Build file '/Users/xyz/abc/sample/build.gradle.kts' line: 27

* What went wrong:
Script compilation errors:

  Line 27:     api(libs.my.library.string.interface)
                                                                            ^ Name expected

  Line 32:     testImplementation(libs.org.jetbrains.kotlin.kotlin.test)
                                                                        ^ Expecting ')'

2 errors

Gradle version

8.6

Build scan URL (optional)

No response

Your Environment (optional)

No response

pawelkw avatar Feb 16 '24 11:02 pawelkw

The issue is in the backlog of the relevant team and is prioritized by them.

ljacomet avatar Feb 19 '24 09:02 ljacomet