I'm writing an application using JavaFX and when I try to download sources I'm getting this error after upgrading to id 'org.openjfx.javafxplugin' version '0.1.0'
:
Execution failed for task ':ijDownloadSourceseac56644-f3d'.
> Could not resolve all files for configuration ':downloadSources_d8a57fab-051b-40e6-9c30-2d1f5d9d5ae1'.
> Could not resolve org.openjfx:javafx-fxml:21.
Required by:
project :
> Cannot choose between the following variants of org.openjfx:javafx-fxml:21:
- linux-aarch64Runtime
- linuxRuntime
- mac-aarch64Runtime
- macRuntime
- runtime
- winRuntime
All of them match the consumer attributes:
- Variant 'linux-aarch64Runtime' capability org.openjfx:javafx-fxml:21:
- Unmatched attributes:
- Provides org.gradle.category 'library' but the consumer didn't ask for it
- Provides org.gradle.libraryelements 'jar' but the consumer didn't ask for it
- Provides org.gradle.native.architecture 'aarch64' but the consumer didn't ask for it
- Provides org.gradle.native.operatingSystem 'linux' but the consumer didn't ask for it
- Provides org.gradle.status 'release' but the consumer didn't ask for it
- Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it
- Variant 'linuxRuntime' capability org.openjfx:javafx-fxml:21:
- Unmatched attributes:
- Provides org.gradle.category 'library' but the consumer didn't ask for it
- Provides org.gradle.libraryelements 'jar' but the consumer didn't ask for it
- Provides org.gradle.native.architecture 'x86-64' but the consumer didn't ask for it
- Provides org.gradle.native.operatingSystem 'linux' but the consumer didn't ask for it
- Provides org.gradle.status 'release' but the consumer didn't ask for it
- Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it
- Variant 'mac-aarch64Runtime' capability org.openjfx:javafx-fxml:21:
- Unmatched attributes:
- Provides org.gradle.category 'library' but the consumer didn't ask for it
- Provides org.gradle.libraryelements 'jar' but the consumer didn't ask for it
- Provides org.gradle.native.architecture 'aarch64' but the consumer didn't ask for it
- Provides org.gradle.native.operatingSystem 'macos' but the consumer didn't ask for it
- Provides org.gradle.status 'release' but the consumer didn't ask for it
- Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it
- Variant 'macRuntime' capability org.openjfx:javafx-fxml:21:
- Unmatched attributes:
- Provides org.gradle.category 'library' but the consumer didn't ask for it
- Provides org.gradle.libraryelements 'jar' but the consumer didn't ask for it
- Provides org.gradle.native.architecture 'x86-64' but the consumer didn't ask for it
- Provides org.gradle.native.operatingSystem 'macos' but the consumer didn't ask for it
- Provides org.gradle.status 'release' but the consumer didn't ask for it
- Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it
- Variant 'runtime' capability org.openjfx:javafx-fxml:21:
- Unmatched attributes:
- Provides org.gradle.category 'library' but the consumer didn't ask for it
- Provides org.gradle.libraryelements 'jar' but the consumer didn't ask for it
- Provides org.gradle.status 'release' but the consumer didn't ask for it
- Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it
- Variant 'winRuntime' capability org.openjfx:javafx-fxml:21:
- Unmatched attributes:
- Provides org.gradle.category 'library' but the consumer didn't ask for it
- Provides org.gradle.libraryelements 'jar' but the consumer didn't ask for it
- Provides org.gradle.native.architecture 'x86-64' but the consumer didn't ask for it
- Provides org.gradle.native.operatingSystem 'windows' but the consumer didn't ask for it
- Provides org.gradle.status 'release' but the consumer didn't ask for it
- Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it
* 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.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.5/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD FAILED in 111ms
1 actionable task: 1 executed
I'm trying to fix that as per plugin page but no luck so far. Can you please help me to understand why the osConfiguration configuration is not applied? Gradle import is successfull, but I'm still getting the above error. I'm totally lost now :(
This is my build.gradle:
import org.openjfx.gradle.JavaFXPlatform
plugins {
id 'java'
id 'application'
id 'org.javamodularity.moduleplugin' version '1.8.12'
id 'org.openjfx.javafxplugin' version '0.1.0'
id "com.google.osdetector" version "1.7.3"
id 'org.beryx.jlink' version '3.0.1'
id "io.freefair.lombok" version "8.6"
}
group 'io.github.vcvitaly'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
ext {
junitVersion = '5.10.2'
platform = getPlatform()
}
configurations {
osConfiguration
}
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
application {
mainModule = 'io.github.vcvitaly.k8cp'
mainClass = 'io.github.vcvitaly.k8cp.HelloApplication'
}
javafx {
version = JavaVersion.VERSION_21
modules = ['javafx.controls', 'javafx.fxml']
}
dependencies {
implementation('org.controlsfx:controlsfx:11.1.2')
implementation('net.synedra:validatorfx:0.4.0') {
exclude(group: 'org.openjfx')
}
implementation('org.kordamp.ikonli:ikonli-javafx:12.3.1')
implementation 'org.kordamp.ikonli:ikonli-fontawesome-pack:12.3.1'
implementation 'org.kordamp.ikonli:ikonli-fontawesome5-pack:12.3.1'
implementation('org.kordamp.bootstrapfx:bootstrapfx-core:0.4.0')
implementation 'ch.qos.logback:logback-core:1.5.2'
implementation 'org.slf4j:slf4j-api:2.0.12'
implementation 'ch.qos.logback:logback-classic:1.5.2'
implementation ("io.kubernetes:client-java:20.0.0") {
exclude group: "com.google.code.findbugs", module: "jsr305"
exclude group: "com.amazonaws", module: "aws-java-sdk-sts"
}
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-params:${junitVersion}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
testImplementation 'org.mockito:mockito-core:5.11.0'
testImplementation "org.assertj:assertj-core:3.25.1"
}
test {
useJUnitPlatform()
}
jlink {
imageZip = project.file("${buildDir}/distributions/app-${javafx.platform.classifier}.zip")
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
launcher {
name = 'app'
}
}
jlinkZip {
group = 'distribution'
}
configurations.osConfiguration {
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, Usage.JAVA_RUNTIME))
attribute(OperatingSystemFamily.OPERATING_SYSTEM_ATTRIBUTE, objects.named(OperatingSystemFamily, platform.osFamily))
attribute(MachineArchitecture.ARCHITECTURE_ATTRIBUTE, objects.named(MachineArchitecture, platform.arch))
}
}
def getPlatform() {
return JavaFXPlatform.detect(osdetector);
}
So far was able to resolve it:
configurations
.matching(it -> it.name.contains("downloadSources"))
.configureEach {
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, Usage.JAVA_RUNTIME))
attribute(OperatingSystemFamily.OPERATING_SYSTEM_ATTRIBUTE, objects.named(OperatingSystemFamily, platform.osFamily))
attribute(MachineArchitecture.ARCHITECTURE_ATTRIBUTE, objects.named(MachineArchitecture, platform.arch))
}
}