quarkus icon indicating copy to clipboard operation
quarkus copied to clipboard

Gradle: `:quarkusDependenciesBuild` uses this output of `:jandex` without declaring dependency

Open joschi opened this issue 1 year ago • 7 comments

Describe the bug

A new minimal Quarkus project using Gradle 8.10. as build system fails to build due to a missing dependency declaration to the org.kordamp.gradle.jandex plugin.

Expected behavior

Build should be successful.

When removing the Jandex plugin from build.gradle.kts, the build succeeds:

❯ ./gradlew build

BUILD SUCCESSFUL in 1s
7 actionable tasks: 6 executed, 1 up-to-date

Actual behavior

❯ ./gradlew build
> Task :quarkusDependenciesBuild FAILED

FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':quarkusDependenciesBuild' (type 'QuarkusBuildDependencies').
  - Gradle detected a problem with the following location: '/path/to/quarkus-jandex/build/resources/main'.
    
    Reason: Task ':quarkusDependenciesBuild' uses this output of task ':jandex' 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 ':jandex' as an input of ':quarkusDependenciesBuild'.
      2. Declare an explicit dependency on ':jandex' from ':quarkusDependenciesBuild' using Task#dependsOn.
      3. Declare an explicit dependency on ':jandex' from ':quarkusDependenciesBuild' using Task#mustRunAfter.
    
    For more information, please refer to https://docs.gradle.org/8.10.2/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 1s
7 actionable tasks: 5 executed, 2 up-to-date

How to Reproduce?

build.gradle.kts:

plugins {
	java
	id("org.kordamp.gradle.jandex") version "2.0.0"
	id("io.quarkus") version "3.15.1"
}

repositories {
	mavenCentral()
}

dependencies {
	implementation(enforcedPlatform("io.quarkus.platform:quarkus-bom:3.15.1"))
}

group = "com.example"
version = "1.0.0-SNAPSHOT"

settings.gradle.kts:

pluginManagement {
	repositories {
		mavenCentral()
		gradlePluginPortal()
	}
}
rootProject.name = "jandex-dependency"

There are no other source files in src/ whatsoever.

Output of uname -a or ver

Darwin macbook.local 23.6.0 Darwin Kernel Version 23.6.0: Wed Jul 31 20:48:04 PDT 2024; root:xnu-10063.141.1.700.5~1/RELEASE_ARM64_T6030 arm64

Output of java -version

openjdk 21.0.5 2024-10-15 LTS

Quarkus version or git rev

3.15.1

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

Gradle 8.10.2

Additional information

No response

joschi avatar Oct 18 '24 07:10 joschi

/cc @geoand (kotlin), @glefloch, @quarkusio/devtools

quarkus-bot[bot] avatar Oct 18 '24 07:10 quarkus-bot[bot]

cc @aloubyansky

geoand avatar Oct 18 '24 08:10 geoand

Other affected tasks:

  • io.quarkus.gradle.tasks.QuarkusBuildDependencies
  • io.quarkus.gradle.tasks.QuarkusShowEffectiveConfig
  • io.quarkus.gradle.tasks.ImageBuild

Apparently anything inheriting from io.quarkus.gradle.tasks.QuarkusBuildTask.

joschi avatar Oct 24 '24 13:10 joschi

Same issue. And try to use the afterEvaluate to resolve it.

afterEvaluate {
    var taskJandex = tasks.named("jandex")
    var quarkusDependenciesBuild = tasks.named("quarkusDependenciesBuild")
    println "Task jandex: $taskJandex"
    println "Task quarkusDependenciesBuild: $quarkusDependenciesBuild"
    if (taskJandex && quarkusDependenciesBuild) {
        quarkusDependenciesBuild.get().dependsOn(taskJandex)
    } else {
        println("One or both jandex related tasks are not present. Task quarkusDependenciesBuild.dependsOn(jandex).")
        println("Task jandex: $taskJandex")
        println("Task quarkusDependenciesBuild: $quarkusDependenciesBuild")
    }
}

See Jandex plugin breaks standalone Quarkus module Tests

linxux avatar Nov 01 '24 17:11 linxux

I ran into the same problem as op and this fixed the problem

Thanks!

mikeleitz avatar Dec 25 '24 20:12 mikeleitz

What’s the status of this issue? Has the bug been accepted?

rodcheater avatar Jun 13 '25 04:06 rodcheater

This issue will be fixed in the next release. Thanks.

aloubyansky avatar Jun 13 '25 08:06 aloubyansky