Open ylk2534246654 opened 1 year ago
一样的报错,希望能得到解决
Translation: I have the same error, hope it can be resolved
Caused by: org.gradle.api.GradleException: Cannot use @TaskAction annotation on method DetectEntityCandidatesTask.execute() because interface org.gradle.api.tasks.incremental.IncrementalTaskInputs is not a valid parameter to an action method.
Looks like there is a breaking API change in Gradle 8.0. If you must use the greenDAO plugin, please continue using Gradle 7.x.
@greenrobot-team Will there be a fix for this to use Gradle 8?
We use GreenDAO on a huge project and we can't really switch - any kind of patch to get this working would be mostly appreciated 🙇🏽♂️
I'm not able to upgrade my grade due to this issue. I hope it gets resolved soon!
同样的问题,目前只能暂时回退了。希望接下来能够这个问题能被处理
Translation: I have the same problem, and it can only be temporarily rolled back. Hope this issue can be resolved in the future
Same problem, hope it can be resolved.
@zwgKt @SwordWang0228 Please comment in English, otherwise it's hard for others to understand.
I'll share this with the team and see if it makes sense to update (or maybe we can open source the plugin).
Same problem, hope it can be resolved.
+1
i have the same problem, hope it can be resolved.
@greenrobot-team Any news here? If this will not be fixed soon, I will try to migrate to ObjectBox. Not my prefered way for our large projects.
@NexusIDS have you considered ktorm ? We are in a similar situation where something has to happen and we might as well change track to something modern and Kotlin.
Please fix the problem soon.
Same issue here
This was caused by Gradle 8 removing the deprecated IncrementalTaskInputs API.
I published version 3.3.1
of the greenDAO Gradle plugin which should fix this issue. To use it update the version in your build.gradle
:
buildscript {
dependencies {
classpath("org.greenrobot:greendao-gradle-plugin:3.3.1")
}
}
Note there is no need to update the greendao library (remains at 3.3.0
).
Please test this in your projects and report here if it works! I only briefly tested it with the greenDAO example project.
If working, I will update the project README to point to this new version.
@greenrobot-team Works with Gradle < 8. With Gradle <= 8 I get this error:
`* Exception is: org.gradle.internal.execution.WorkValidationException: A problem was found with the configuration of task ':app:kaptGenerateStubsAssets_mobile_DebugKotlin' (type 'KaptGenerateStubsTask').
Gradle detected a problem with the following location: '/path/to/folder/app/src/main/java'.
Reason: Task ':app:kaptGenerateStubsAssets_mobile_DebugKotlin' uses this output of task ':app:greendao' 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:
Please refer to https://docs.gradle.org/8.0/userguide/validation_problems.html#implicit_dependency for more details about this problem.`
This was caused by Gradle 8 removing the deprecated IncrementalTaskInputs API.
I published version
3.3.1
of the greenDAO Gradle plugin which should fix this issue. To use it update the version in yourbuild.gradle
:buildscript { dependencies { classpath("org.greenrobot:greendao-gradle-plugin:3.3.1") } }
Note there is no need to update the greendao library (remains at
3.3.0
).Please test this in your projects and report here if it works! I only briefly tested it with the greenDAO example project.
If working, I will update the project README to point to this new version.
I'm successfully upgraded my project to Gradle 8.0.2! Thank you very much for this work!
Builds fine with Gradle 8
@greenrobot-team Works with Gradle < 8. With Gradle <= 8 I get this error:
`* Exception is: org.gradle.internal.execution.WorkValidationException: A problem was found with the configuration of task ':app:kaptGenerateStubsAssets_mobile_DebugKotlin' (type 'KaptGenerateStubsTask').
Gradle detected a problem with the following location: '/path/to/folder/app/src/main/java'. Reason: Task ':app:kaptGenerateStubsAssets_mobile_DebugKotlin' uses this output of task ':app:greendao' 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 ':app:greendao' as an input of ':app:kaptGenerateStubsAssets_mobile_DebugKotlin'.
- Declare an explicit dependency on ':app:greendao' from ':app:kaptGenerateStubsAssets_mobile_DebugKotlin' using Task#dependsOn.
- Declare an explicit dependency on ':app:greendao' from ':app:kaptGenerateStubsAssets_mobile_DebugKotlin' using Task#mustRunAfter.
Please refer to https://docs.gradle.org/8.0/userguide/validation_problems.html#implicit_dependency for more details about this problem.`
Ya I still getting this issue with Plugin 3.3.1 and Gradle 8.0.2
@greenrobot-team any news?
@BoykoDmytro See https://github.com/greenrobot/greenDAO/issues/1110#issuecomment-1609217601 Or what do you mean?
Edit: I had no time to look at issue when using the plugin with Kotlin projects, yet. But from a first look it might require manually setting up the greendao task as an input of the Kotlin compile tasks.
yes, u are right. Also for other 3 tasks like KotlinDebug, kaptGenerateStubsDebugKotlin, etc.
A problem was found with the configuration of task ':app:kaptGenerateStubsDebugKotlin' (type 'KaptGenerateStubsTask').
Reason: Task ':app:kaptGenerateStubsDebugKotlin' uses this output of task ':app:greendao' 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:
1. Declare task ':app:greendao' as an input of ':app:kaptGenerateStubsDebugKotlin'.
2. Declare an explicit dependency on ':app:greendao' from ':app:kaptGenerateStubsDebugKotlin' using Task#dependsOn.
3. Declare an explicit dependency on ':app:greendao' from ':app:kaptGenerateStubsDebugKotlin' using Task#mustRunAfter.```
This works like a charm! Thank you so much for doing this and buying everyone a bit more time !
For kotlin projects, please add the following statement to the build.gradle
file:
tasks.whenTaskAdded { task ->
if (task.name.matches("compile\\w*Kotlin")) {
task.dependsOn('greendao')
}
}
thx
A problem was found with the configuration of task ':app:greendao' (type 'DefaultTask').
Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Exception is: org.gradle.internal.execution.WorkValidationException: A problem was found with the configuration of task ':app:greendao' (type 'DefaultTask').
Reason: Task ':app:compileDebugKotlin' uses this output of task ':app:greendao' 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:
Please refer to https://docs.gradle.org/8.0/userguide/validation_problems.html#implicit_dependency for more details about this problem. at org.gradle.internal.execution.WorkValidationException$BuilderWithSummary.build(WorkValidationException.java:133) at org.gradle.internal.execution.WorkValidationException$BuilderWithSummary.get(WorkValidationException.java:115) at org.gradle.internal.execution.steps.ValidateStep.throwValidationException(ValidateStep.java:162) at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:86) at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:49) at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:71) at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:45) at org.gradle.internal.execution.steps.SkipEmptyWorkStep.executeWithNonEmptySources(SkipEmptyWorkStep.java:177) at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:81) at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:53) at org.gradle.internal.execution.steps.RemoveUntrackedExecutionStateStep.execute(RemoveUntrackedExecutionStateStep.java:32) at org.gradle.internal.execution.steps.RemoveUntrackedExecutionStateStep.execute(RemoveUntrackedExecutionStateStep.java:21) at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:38) at org.gradle.internal.execution.steps.LoadPreviousExecutionStateStep.execute(LoadPreviousExecutionStateStep.java:36) at org.gradle.internal.execution.steps.LoadPreviousExecutionStateStep.execute(LoadPreviousExecutionStateStep.java:23) at org.gradle.internal.execution.steps.CleanupStaleOutputsStep.execute(CleanupStaleOutputsStep.java:75) at org.gradle.internal.execution.steps.CleanupStaleOutputsStep.execute(CleanupStaleOutputsStep.java:41) at org.gradle.internal.execution.steps.AssignWorkspaceStep.lambda$execute$0(AssignWorkspaceStep.java:32) at org.gradle.api.internal.tasks.execution.TaskExecution$4.withWorkspace(TaskExecution.java:287) at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:30) at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:21) at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:37) at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:27) at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:42) at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:31) at org.gradle.internal.execution.impl.DefaultExecutionEngine$1.execute(DefaultExecutionEngine.java:64) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:146) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:135) at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46) at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:74) at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36) at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77) at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55) at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52) at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204) at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199) at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66) at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59) at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53) at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73) at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52) at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:42) at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:338) at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:325) at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:318) at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:304) at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:463) at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:380) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64) at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:49)
For kotlin projects, please add the following statement to the
build.gradle
file:tasks.whenTaskAdded { task -> if (task.name.matches("compile\\w*Kotlin")) { task.dependsOn('greendao') } }
@greenrobot-team Works with Gradle < 8. With Gradle <= 8 I get this error: `* Exception is: org.gradle.internal.execution.WorkValidationException: A problem was found with the configuration of task ':app:kaptGenerateStubsAssets_mobile_DebugKotlin' (type 'KaptGenerateStubsTask').
Gradle detected a problem with the following location: '/path/to/folder/app/src/main/java'. Reason: Task ':app:kaptGenerateStubsAssets_mobile_DebugKotlin' uses this output of task ':app:greendao' 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 ':app:greendao' as an input of ':app:kaptGenerateStubsAssets_mobile_DebugKotlin'.
- Declare an explicit dependency on ':app:greendao' from ':app:kaptGenerateStubsAssets_mobile_DebugKotlin' using Task#dependsOn.
- Declare an explicit dependency on ':app:greendao' from ':app:kaptGenerateStubsAssets_mobile_DebugKotlin' using Task#mustRunAfter.
Please refer to https://docs.gradle.org/8.0/userguide/validation_problems.html#implicit_dependency for more details about this problem.`
Ya I still getting this issue with Plugin 3.3.1 and Gradle 8.0.2
Tried but still no luck, thanks anyway
For kotlin projects, please add the following statement to the
build.gradle
file:tasks.whenTaskAdded { task -> if (task.name.matches("compile\\w*Kotlin")) { task.dependsOn('greendao') } }
@greenrobot-team Works with Gradle < 8. With Gradle <= 8 I get this error: `* Exception is: org.gradle.internal.execution.WorkValidationException: A problem was found with the configuration of task ':app:kaptGenerateStubsAssets_mobile_DebugKotlin' (type 'KaptGenerateStubsTask').
Gradle detected a problem with the following location: '/path/to/folder/app/src/main/java'. Reason: Task ':app:kaptGenerateStubsAssets_mobile_DebugKotlin' uses this output of task ':app:greendao' 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 ':app:greendao' as an input of ':app:kaptGenerateStubsAssets_mobile_DebugKotlin'.
- Declare an explicit dependency on ':app:greendao' from ':app:kaptGenerateStubsAssets_mobile_DebugKotlin' using Task#dependsOn.
- Declare an explicit dependency on ':app:greendao' from ':app:kaptGenerateStubsAssets_mobile_DebugKotlin' using Task#mustRunAfter.
Please refer to https://docs.gradle.org/8.0/userguide/validation_problems.html#implicit_dependency for more details about this problem.`
Ya I still getting this issue with Plugin 3.3.1 and Gradle 8.0.2
Tried but still no luck, thanks anyway
Do you use Kotlin serialization? This is the reason for one of my projects to fail. Very sad, that I can't use Kotlins JSON-serialization anymore..
For kotlin projects, please add the following statement to the
build.gradle
file:tasks.whenTaskAdded { task -> if (task.name.matches("compile\\w*Kotlin")) { task.dependsOn('greendao') } }
@greenrobot-team Works with Gradle < 8. With Gradle <= 8 I get this error: `* Exception is: org.gradle.internal.execution.WorkValidationException: A problem was found with the configuration of task ':app:kaptGenerateStubsAssets_mobile_DebugKotlin' (type 'KaptGenerateStubsTask').
Gradle detected a problem with the following location: '/path/to/folder/app/src/main/java'. Reason: Task ':app:kaptGenerateStubsAssets_mobile_DebugKotlin' uses this output of task ':app:greendao' 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 ':app:greendao' as an input of ':app:kaptGenerateStubsAssets_mobile_DebugKotlin'.
- Declare an explicit dependency on ':app:greendao' from ':app:kaptGenerateStubsAssets_mobile_DebugKotlin' using Task#dependsOn.
- Declare an explicit dependency on ':app:greendao' from ':app:kaptGenerateStubsAssets_mobile_DebugKotlin' using Task#mustRunAfter.
Please refer to https://docs.gradle.org/8.0/userguide/validation_problems.html#implicit_dependency for more details about this problem.`
Ya I still getting this issue with Plugin 3.3.1 and Gradle 8.0.2
Tried but still no luck, thanks anyway
It's the same mistake
在app目录下build.gradle 中添加 project.afterEvaluate { getTasksByName("compileDebugKotlin", false).forEach { it.mustRunAfter("greendao") } }
the problem has been resolved after adding the following settings to the app level build.gradle
tasks.configureEach { task ->
if (task.name.matches("\\w*compile\\w*Kotlin")) {
task.dependsOn('greendao')
}
if (task.name.matches("\\w*kaptGenerateStubs\\w*Kotlin")) {
task.dependsOn('greendao')
}
if (task.name.matches("\\w*kapt\\w*Kotlin")) {
task.dependsOn('greendao')
}
}
Add
classpath "org.greenrobot:greendao-gradle-plugin:3.3.1"
to Project-level build.gradle
And Add
tasks.configureEach { task ->
if (task.name.matches("\\w*compile\\w*Kotlin")) {
task.dependsOn('greendao')
}
if (task.name.matches("\\w*kaptGenerateStubs\\w*Kotlin")) {
task.dependsOn('greendao')
}
if (task.name.matches("\\w*kapt\\w*Kotlin")) {
task.dependsOn('greendao')
}
}
to App-level build.gradle useful to me
Do u have any solution with ksp?
@BoykoDmytro It is unlikely we will ever add support for the Kotlin Symbol Processing API (KSP). greenDAO itself is written to work with Java.
the problem has been resolved after adding the following settings to the app level build.gradle
tasks.configureEach { task -> if (task.name.matches("\\w*compile\\w*Kotlin")) { task.dependsOn('greendao') } if (task.name.matches("\\w*kaptGenerateStubs\\w*Kotlin")) { task.dependsOn('greendao') } if (task.name.matches("\\w*kapt\\w*Kotlin")) { task.dependsOn('greendao') } }
Niu Bi 666
@BoykoDmytro for KSP:
if (task.name.matches("\\w*ksp\\w*Kotlin")) {
task.dependsOn('greendao')
}
for me this works
tasks.configureEach { task ->
if (task.name.matches("\\w*compile\\w*Kotlin")) {
task.dependsOn('greendao')
}
if (task.name.matches("\\w*kaptGenerateStubs\\w*Kotlin")) {
task.dependsOn('greendao')
}
if (task.name.matches("\\w*kapt\\w*Kotlin")) {
task.dependsOn('greendao')
}
}
Workaround
There is a breaking API change in Gradle 8.0. If you must use the greenDAO plugin, a bugfix release is available in preview.
Original issue