使用此gradle构建文件:
buildscript {
repositories {
jcenter()
google()
mavenCentral()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
maven {
url 'https://plugins.gradle.org/m2/'
}
}
dependencies {
classpath 'com.gluonhq:client-gradle-plugin:0.1.30'
}
}
plugins {
// id 'com.gluonhq.client-gradle-plugin' version '0.1.30'
id 'org.openjfx.javafxplugin' version '0.0.9'
id 'org.beryx.jlink' version '2.21.2'
id 'eclipse'
id 'org.kordamp.gradle.jdeps' version '0.11.0'
}
apply plugin: 'com.gluonhq.client-gradle-plugin'
repositories {
jcenter()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
sourceCompatibility = 14
targetCompatibility = 14
dependencies {
runtimeOnly "org.openjfx:javafx-graphics:14:win"
runtimeOnly "org.openjfx:javafx-graphics:14:mac"
runtimeOnly "org.openjfx:javafx-graphics:14:linux"
compile 'com.gluonhq:charm:6.0.5'
compile 'org.reactfx:reactfx:2.0-M5'
compileOnly "org.projectlombok:lombok:1.18.12"
annotationProcessor 'org.projectlombok:lombok:1.18.12'
}
javafx {
version = "14"
modules = [ 'javafx.controls', 'javafx.fxml' ]
}
gluonClient {
// target = "ios" // uncomment to deploy on iOS
// target = "android" // uncomment to deploy on Android
attachConfig {
version = "4.0.8"
services 'display', 'lifecycle', 'statusbar', 'storage'
}
}
mainClassName = 'com.my.Client'
jar {
manifest {
attributes 'Main-Class': 'com.my.Main'
}
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
}
eclipse {
classpath {
downloadJavadoc = true
downloadSources = true
}
}
wrapper {
gradleVersion = '6.6'
}
运行构建任务时,我得到:
java:24: error: package com.gluonhq.charm.glisten.control does not exist
import com.gluonhq.charm.glisten.control.Dialog;
java:17: error: package com.gluonhq.charm.glisten.application does not exist
import com.gluonhq.charm.glisten.application.MobileApplication;
java:43: error: package com.gluonhq.charm.glisten.mvc does not exist
import com.gluonhq.charm.glisten.mvc.View;
java:44: error: package com.gluonhq.charm.glisten.visual does not exist
import com.gluonhq.charm.glisten.visual.MaterialDesignIcon;
在Eclipse中转到项目和外部依赖项时,我可以看到charm-6.0.5.jar
和charm-glisten-6.0.5.jar
。 Eclipse没有任何编译问题,并且通过Eclipse可以正确启动项目。
该项目是非模块化的,使用jdk-14。 Gradle缺少什么?