Open MarceloRuiz opened 8 months ago
/cc @glefloch, @quarkusio/devtools
This problem can be fixed with the following code:
configurations.matching {
it.isCanBeResolved && it.name.toString().contains("quarkus")
}.configureEach {
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named<Usage>(Usage.JAVA_RUNTIME))
attribute(OperatingSystemFamily.OPERATING_SYSTEM_ATTRIBUTE, objects.named<OperatingSystemFamily>("linux"))
attribute(MachineArchitecture.ARCHITECTURE_ATTRIBUTE, objects.named<MachineArchitecture>("x86-64"))
}
}
But I feel this is a workaround only. Maybe someone with knowledge about quarkus can comment on this? Thanks
This problem can be fixed with the following code:
configurations.matching { it.isCanBeResolved && it.name.toString().contains("quarkus") }.configureEach { attributes { attribute(Usage.USAGE_ATTRIBUTE, objects.named<Usage>(Usage.JAVA_RUNTIME)) attribute(OperatingSystemFamily.OPERATING_SYSTEM_ATTRIBUTE, objects.named<OperatingSystemFamily>("linux")) attribute(MachineArchitecture.ARCHITECTURE_ATTRIBUTE, objects.named<MachineArchitecture>("x86-64")) } }
But I feel this is a workaround only. Maybe someone with knowledge about quarkus can comment on this? Thanks
Alternatively:
configurations.matching {
it.isCanBeResolved && it.name.contains("quarkus")
}.configureEach {
val runtimeAttributes = configurations.runtimeClasspath.get().attributes
runtimeAttributes.keySet().forEach { key ->
@Suppress("UNCHECKED_CAST")
attributes.attribute(key as Attribute<Any>, runtimeAttributes.getAttribute(key) as Any)
}
}
Not sure what code You are referring to. If you make it a PR we can see and run the test suite and see if anything obvious breaks.
This works for me using groovy and Gradle 8.6
configurations.matching {
it.isCanBeResolved() && it.name.contains("quarkus")
}.configureEach {
attributes {
attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage.class, Usage.JAVA_RUNTIME))
attribute(OperatingSystemFamily.OPERATING_SYSTEM_ATTRIBUTE, project.objects.named(OperatingSystemFamily.class, "linux"))
attribute(MachineArchitecture.ARCHITECTURE_ATTRIBUTE, project.objects.named(MachineArchitecture.class, "x86-64"))
}
}
Describe the bug
Just by applying the
quarkus.io
gradle plugin to a minimal (but working) JavaFX Application, causes broken dependency resolutions (Cannot choose between following variants) during taskquarkusGenerateCode
even though the platform and architecture are correctly detected.Expected behavior
Applying the quarkus.io plugin should not break dependency resolution for a working project
Actual behavior
A configuration exception is thrown because quarkus cannot choose between variants of javafx libraries
How to Reproduce?
simple-jfx.zip
Sample application attached.
Unzip, cd into
simple-jfx
dir and build with:./gradew clean build
The app will build with no problem.
Edit the file
simple-jfx/jfxapp/build.gradle.kts
and remove//
in from the plugin to apply it. Save the file and execute again:./gradew clean build
and the exception will be thrown
Output of
uname -a
orver
Linux 6.2.0-36-generic #37~22.04.1-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux
Output of
java -version
openjdk 21 2023-09-19 / OpenJDK Runtime Environment GraalVM CE 21+35.1 (build 21+35-jvmci-23.1-b15) / OpenJDK 64-Bit Server VM GraalVM CE 21+35.1 (build 21+35-jvmci-23.1-b15, mixed mode, sharing)
Quarkus version or git rev
3.4.3
Build tool (ie. output of
mvnw --version
orgradlew --version
)Gradle 8.4
Additional information
No response