google / google/protobuf-gradle-plugin

KSP dependency on generateProto - unable to build project due to KspTaskJvm issue

Open
#740 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Groovy
Stars
1.8k
Forks
288
PR merge metrics
No merged PRs in 30d

Description

I am using Kotlin 1.9.20 with Gradle 8.4 with id("com.google.devtools.ksp") version "1.9.20-1.0.14" in a gradle multimodule project and I am unable to build the project. Getting the errors below:

**What went wrong:**
```
Some problems were found with the configuration of task ':xxxxx:kspKotlin' (type 'KspTaskJvm').

Gradle detected a problem with the following location: 'C:\Users...\ServiceGrpc.java'.

Reason: Task ':xxxxx-rest:kspKotlin' uses this output of task ':xxxxx-rest:generateProto' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.

Possible solutions:

Declare task ':xxxxx-rest:generateProto' as an input of ':xxxxx-rest:kspKotlin'.
Declare an explicit dependency on ':xxxxx-rest:generateProto' from ':xxxxx-rest:kspKotlin' using Task#dependsOn.
Declare an explicit dependency on ':xxxxx-rest:generateProto' from ':xxxxx-rest:kspKotlin' using Task#mustRunAfte
r.
```

When setting explicit dependency as suggest, gradle is unable to find the task kspKotlin.

Thanks

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported configuration with Kotlin 1.9.20, Gradle 8.4, KSP 1.9.20-1.0.14, and the tasks :xxxxx-rest:generateProto and :xxxxx-rest:kspKotlin. Trace how the plugin wires generated ServiceGrpc.java into KSP, then verify that a clean build succeeds without a manual task dependency.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.