Skip to content

Intellij: Task sequence for task 'compileQuarkusGeneratedSourcesJava' not correct (Gradle, Kotlin, Multi-Module Project) #38996

@mschorsch

Description

@mschorsch

Describe the bug

We use Quarkus, Kotlin and Gradle in our various projects.

In multi-module projects we get the following error in Intellij:

FAILURE: Build failed with an exception.

* What went wrong:
Some problems were found with the configuration of task ':app-editor-server:compileKotlin' (type 'KotlinCompile').
  - Gradle detected a problem with the following location: '/home/user1/development/sources/app-editor/app-editor-server/build/classes/java/quarkus-generated-sources'.
    
    Reason: Task ':app-editor-server:compileKotlin' uses this output of task ':app-editor-server:compileQuarkusGeneratedSourcesJava' 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-editor-server:compileQuarkusGeneratedSourcesJava' as an input of ':app-editor-server:compileKotlin'.
      2. Declare an explicit dependency on ':app-editor-server:compileQuarkusGeneratedSourcesJava' from ':app-editor-server:compileKotlin' using Task#dependsOn.
      3. Declare an explicit dependency on ':app-editor-server:compileQuarkusGeneratedSourcesJava' from ':app-editor-server:compileKotlin' using Task#mustRunAfter.
    
    For more information, please refer to https://docs.gradle.org/8.6/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.
  - Gradle detected a problem with the following location: '/home/user1/development/sources/app-editor/app-editor-server/build/classes/java/quarkus-generated-sources/grpc'.
    
    Reason: Task ':app-editor-server:compileKotlin' uses this output of task ':app-editor-server:compileQuarkusGeneratedSourcesJava' 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-editor-server:compileQuarkusGeneratedSourcesJava' as an input of ':app-editor-server:compileKotlin'.
      2. Declare an explicit dependency on ':app-editor-server:compileQuarkusGeneratedSourcesJava' from ':app-editor-server:compileKotlin' using Task#dependsOn.
      3. Declare an explicit dependency on ':app-editor-server:compileQuarkusGeneratedSourcesJava' from ':app-editor-server:compileKotlin' using Task#mustRunAfter.
    
    For more information, please refer to https://docs.gradle.org/8.6/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.
  - Gradle detected a problem with the following location: '/home/user1/development/sources/app-editor/app-editor-server/build/classes/java/quarkus-generated-sources/avdl'.
    
    Reason: Task ':app-editor-server:compileKotlin' uses this output of task ':app-editor-server:compileQuarkusGeneratedSourcesJava' 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-editor-server:compileQuarkusGeneratedSourcesJava' as an input of ':app-editor-server:compileKotlin'.
      2. Declare an explicit dependency on ':app-editor-server:compileQuarkusGeneratedSourcesJava' from ':app-editor-server:compileKotlin' using Task#dependsOn.
      3. Declare an explicit dependency on ':app-editor-server:compileQuarkusGeneratedSourcesJava' from ':app-editor-server:compileKotlin' using Task#mustRunAfter.
    
    For more information, please refer to https://docs.gradle.org/8.6/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.
  - Gradle detected a problem with the following location: '/home/user1/development/sources/app-editor/app-editor-server/build/classes/java/quarkus-generated-sources/avpr'.
    
    Reason: Task ':app-editor-server:compileKotlin' uses this output of task ':app-editor-server:compileQuarkusGeneratedSourcesJava' 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-editor-server:compileQuarkusGeneratedSourcesJava' as an input of ':app-editor-server:compileKotlin'.
      2. Declare an explicit dependency on ':app-editor-server:compileQuarkusGeneratedSourcesJava' from ':app-editor-server:compileKotlin' using Task#dependsOn.
      3. Declare an explicit dependency on ':app-editor-server:compileQuarkusGeneratedSourcesJava' from ':app-editor-server:compileKotlin' using Task#mustRunAfter.
    
    For more information, please refer to https://docs.gradle.org/8.6/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.
  - Gradle detected a problem with the following location: '/home/user1/development/sources/app-editor/app-editor-server/build/classes/java/quarkus-generated-sources/avsc'.
    
    Reason: Task ':app-editor-server:compileKotlin' uses this output of task ':app-editor-server:compileQuarkusGeneratedSourcesJava' 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-editor-server:compileQuarkusGeneratedSourcesJava' as an input of ':app-editor-server:compileKotlin'.
      2. Declare an explicit dependency on ':app-editor-server:compileQuarkusGeneratedSourcesJava' from ':app-editor-server:compileKotlin' using Task#dependsOn.
      3. Declare an explicit dependency on ':app-editor-server:compileQuarkusGeneratedSourcesJava' from ':app-editor-server:compileKotlin' using Task#mustRunAfter.
    
    For more information, please refer to https://docs.gradle.org/8.6/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 15s

The error only occurs when compiling with the Intellij integrated function Rebuild Project. Compiling with ./gradlew build works without problems.

We were able to determine the following prerequisites for the error to occur in Intellij:

  • Multi-Module project
  • Kotlin
  • Gradle

To workaround the problem we use:

subprojects {
   //...

    tasks.matching { it.name == "compileQuarkusGeneratedSourcesJava" }.configureEach {
        mustRunAfter(tasks.compileKotlin)
    }

   //...
}

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

So far I have not managed to create a small reproducer.

Output of uname -a or ver

Linux

Output of java -version

Java 17

Quarkus version or git rev

Quarkus 3.7.4

Build tool (ie. output of mvnw --version or gradlew --version)

Gradle

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions