我是第一次在 JavaFX 上工作,我无法在 Intellij 中向我的 Gradle 项目添加库。
我尝试了很多在互联网上找到的解决方案,但我无法解决我的问题。
我要安装的库是 com.itextpdf/itext7-core/7.0.4.
我尝试在 gradle 构建项目中添加实现代码行,但它并没有解决我的问题。我还尝试从 intellij 的项目设置中添加库,甚至在库下载到“lib”文件夹后我也无法使用库的类。
如果有人知道教程或可以描述一步一步的指南,那将非常有帮助。
我上传了所有文件到github,我删除了我所做的所有测试。
这里是构建 gradle 文件
plugins {
id 'java'
id 'application'
id 'org.javamodularity.moduleplugin' version '1.8.12'
id 'org.openjfx.javafxplugin' version '0.0.13'
id 'org.beryx.jlink' version '2.25.0'
}
group 'com.preventivoApp'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
ext {
junitVersion = '5.9.1'
}
sourceCompatibility = '17'
targetCompatibility = '17'
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
application {
mainModule = 'com.preventivoapp.appproject_preventivo'
mainClass = 'com.preventivoapp.appproject_preventivo.HelloApplication'
}
javafx {
version = '17.0.2'
modules = ['javafx.controls', 'javafx.fxml']
}
dependencies {
implementation('org.controlsfx:controlsfx:11.1.2')
testImplementation("org.junit.jupiter:junit-jupiter-api:${junitVersion}")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${junitVersion}")
}
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'
}