forked from ririv/QuickOutline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
131 lines (102 loc) · 4 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
plugins {
id 'application'
// 请不要使用0.0.9版本,有bug
id 'org.openjfx.javafxplugin' version '0.0.13'
id 'org.beryx.jlink' version '2.26.0'
id 'idea'
}
version = '1.0.1'
javafx {
version = "19"
modules = ['javafx.controls', 'javafx.fxml','javafx.web']
}
application{
mainModule.set("quickoutline")
mainClass.set("com.ririv.quickoutline.view.App")
}
//不用加模块名,我也不知道为什么,控制台显示,在模块"..."中寻找此类,加了反而重复
//mainClassName = 'com.ririv.quickoutline.view.App'
//compile 不要用了,已经废弃了
dependencies {
implementation 'com.jfoenix:jfoenix:9.0.10'
implementation 'com.itextpdf:itextpdf:5.5.13.2'
implementation 'com.itextpdf:kernel:7.1.17'
implementation 'com.itextpdf:io:7.1.17'
implementation 'com.itextpdf:layout:7.1.17'
implementation group: 'javax.validation', name: 'validation-api', version: '2.0.1.Final'
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2'
// implementation 'io.github.palexdev:materialfx:11.12.0' //考虑换一个UI库
//一定要与sl4j-api版本一致,在Libraries查找版本
// testImplementation group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.30'
}
repositories {
maven {
//使用https,http会报警告
url 'https://maven.aliyun.com/nexus/content/groups/public/'
}
mavenCentral()
}
[compileJava, compileTestJava, javadoc]*.options*.encoding = 'UTF-8'
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
// options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" //TODO
}
//task copyResources(type: Copy) {
// from "${projectDir}/src/main/resources"
// into "${buildDir}/classes/java/main"
//}
//processResources.dependsOn copyResources
static def isWindows() {
return System.getProperty("os.name").toLowerCase().contains("windows");
}
static def isMacOS() {
return System.getProperty("os.name").toLowerCase().contains("mac");
}
def isLinux() {
return System.getProperty("os.name").toLowerCase().contains("linux");
}
def args = [
"--add-exports=javafx.controls/com.sun.javafx.scene.control=com.jfoenix",
"--add-exports=javafx.base/com.sun.javafx.binding=com.jfoenix",
"--add-exports=javafx.controls/javafx.scene.control.skin=com.jfoenix",
"--add-exports=java.base/java.lang.reflect=ALL-UNNAMED",
"--add-exports=java.base/java.lang.reflect=com.jfoenix",
"--add-exports=javafx.controls/com.sun.javafx.scene.control.behavior=ALL-UNNAMED",
"--add-exports=javafx.controls/com.sun.javafx.scene.control.behavior=com.jfoenix",
"--add-exports=javafx.graphics/com.sun.javafx.stage=com.jfoenix",
"--add-exports=javafx.base/com.sun.javafx.event=ALL-UNNAMED",
"--add-exports=javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED",
"--add-exports=javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED",
"--add-exports=javafx.base/com.sun.javafx.event=com.jfoenix",
"--add-opens=javafx.controls/javafx.scene.control.skin=com.jfoenix",
"--add-opens=java.base/java.lang.reflect=ALL-UNNAMED",
"--add-opens=java.base/java.lang.reflect=com.jfoenix"
]
run {
jvmArgs = args
}
//https://badass-jlink-plugin.beryx.org/releases/latest/
jlink {
launcher {
name = 'QuickOutline'
jvmArgs = args
}
// https://walczak.it/blog/distributing-javafx-desktop-applications-without-requiring-jvm-using-jlink-and-jpackage
jpackage {
// skipInstaller = true
installerOptions = [
'--vendor', 'riri Personal', //必须加,否则报错
'--app-version', version,
]
if (isWindows()){
icon = 'src/main/resources/com/ririv/quickoutline/view/icon/icon.ico'
}
if (isMacOS())
icon = 'src/main/resources/com/ririv/quickoutline/view/icon/icon.icns'
}
}
//jpackage {
// doFirst {
// project.getProperty('installerType') // throws exception if its missing
// }
//}