在Gradle项目中,未从mavencentral()下载JavaFX依赖项

qvtsj1bj  于 2023-03-23  发布在  Maven
关注(0)|答案(1)|浏览(249)

我试图通过在eclipse中集成JavaFX weaver来使用Sping Boot - JavaFX - Gradle创建Java Desktop应用程序。但Java FX库的依赖项(javafx-controls,javafx-base..)无法通过mavencentral的gradle下载,但Spring boot,fxweaver,my sql的其他库都可以正确下载。版本:Sping Boot - 3.0.4、Java fx - 17.0.6、Java - 17、gradle - 7.6.1

plugins {
    id 'java'
    id 'org.springframework.boot' version '3.0.4'
    id 'io.spring.dependency-management' version '1.1.0'
}

group = 'com.test'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'net.rgielen:javafx-weaver-spring-boot-starter:1.3.0'
    runtimeOnly 'com.mysql:mysql-connector-j'
//below javafx libraries are not getting downloaded
    implementation 'org.openjfx:javafx:17.0.6'
    implementation 'org.openjfx:javafx-base:17.0.6'
    implementation 'org.openjfx:javafx-graphics:17.0.6'
    implementation 'org.openjfx:javafx-controls:17.0.6'
    implementation 'org.openjfx:javafx-fxml:17.0.6'
    implementation 'org.openjfx:javafx-swing:17.0.6'
    implementation 'org.openjfx:javafx-media:17.0.6'
    implementation 'org.openjfx:javafx-web:17.0.6'
}

我试过手动添加jar文件,它工作正常。但是在eclipse开发过程中,我无法看到Java FX库组件方法的建议/注解,因为它没有附加源文件。因此我试图通过Gradle下载它。以前有人尝试过吗?任何帮助都非常感谢。

s2j5cfk0

s2j5cfk01#

这是工作的build.gradle文件。我丢失了插件和/或模块部分。

plugins {
    id 'java'
    id 'org.springframework.boot' version '3.0.4'
    id 'io.spring.dependency-management' version '1.1.0'
    id 'org.openjfx.javafxplugin' version '0.0.13'
}

group = 'com.test'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'

repositories {
    mavenCentral()
}

javafx {
    version = "17.0.6"
    modules = [ 'javafx.controls', 'javafx.fxml', 'javafx.swing', 'javafx.media', 'javafx.graphics']
    configuration = 'compileOnly'
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    runtimeOnly 'com.mysql:mysql-connector-j'
    implementation 'net.rgielen:javafx-weaver-spring-boot-starter:1.3.0'
    implementation 'org.openjfx:javafx-base:17.0.6:win'
    implementation 'org.openjfx:javafx-graphics:17.0.6:win'
    implementation 'org.openjfx:javafx-controls:17.0.6:win'
    implementation 'org.openjfx:javafx-fxml:17.0.6:win'
    implementation 'org.openjfx:javafx-swing:17.0.6:win'
    implementation 'org.openjfx:javafx-media:17.0.6:win'
    implementation 'org.openjfx:javafx-web:17.0.6:win'
    
}

相关问题