2025-02-05 15:02:27 +08:00
|
|
|
|
plugins {
|
|
|
|
|
|
id 'java'
|
2025-02-06 20:49:46 +08:00
|
|
|
|
id 'application'
|
|
|
|
|
|
id 'edu.sc.seis.launch4j' version '2.5.4'
|
2025-02-23 13:31:14 +08:00
|
|
|
|
id 'org.openjfx.javafxplugin' version '0.1.0'
|
2025-03-01 16:19:19 +08:00
|
|
|
|
id 'org.springframework.boot' version '3.2.0'
|
|
|
|
|
|
id 'io.spring.dependency-management' version '1.1.4'
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
configurations {
|
|
|
|
|
|
all*.exclude group: 'org.openjfx', module: 'javafx'
|
2025-02-06 20:49:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-02-10 21:20:56 +08:00
|
|
|
|
// JDK 版本检查
|
2025-02-06 20:49:46 +08:00
|
|
|
|
def requiredJavaVersion = 20
|
|
|
|
|
|
def currentJavaVersion = JavaVersion.current().majorVersion.toInteger()
|
|
|
|
|
|
if (currentJavaVersion != requiredJavaVersion) {
|
|
|
|
|
|
throw new GradleException("构建需要 JDK ${requiredJavaVersion},但当前是 JDK ${currentJavaVersion}。请更换 JDK 环境。")
|
2025-02-05 15:02:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
group = 'com.axis.innovators.box'
|
2025-02-10 22:03:56 +08:00
|
|
|
|
version = '0.0.1'
|
2025-02-05 15:02:27 +08:00
|
|
|
|
|
|
|
|
|
|
repositories {
|
2025-03-01 16:19:19 +08:00
|
|
|
|
maven {
|
|
|
|
|
|
url 'https://maven.aliyun.com/repository/public'
|
|
|
|
|
|
metadataSources {
|
|
|
|
|
|
mavenPom()
|
|
|
|
|
|
artifact()
|
|
|
|
|
|
ignoreGradleMetadataRedirection()
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
maven { url 'https://jitpack.io' }
|
2025-03-01 19:51:57 +08:00
|
|
|
|
mavenCentral()
|
2025-02-05 15:02:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
|
|
testImplementation platform('org.junit:junit-bom:5.10.0')
|
|
|
|
|
|
testImplementation 'org.junit.jupiter:junit-jupiter'
|
2025-02-09 12:06:50 +08:00
|
|
|
|
implementation 'org.commonmark:commonmark:0.24.0'
|
|
|
|
|
|
implementation 'org.commonjava.googlecode.markdown4j:markdown4j:2.2-cj-1.1'
|
|
|
|
|
|
implementation 'com.google.code.gson:gson:2.8.9'
|
2025-02-10 13:30:38 +08:00
|
|
|
|
|
|
|
|
|
|
implementation 'org.apache.logging.log4j:log4j-api:2.20.0'
|
|
|
|
|
|
implementation 'org.apache.logging.log4j:log4j-core:2.20.0'
|
|
|
|
|
|
implementation 'org.apache.logging.log4j:log4j-slf4j-impl:2.20.0'
|
|
|
|
|
|
|
2025-03-01 16:19:19 +08:00
|
|
|
|
implementation 'org.ow2.asm:asm:9.7.1'
|
|
|
|
|
|
implementation 'org.ow2.asm:asm-commons:9.7.1'
|
|
|
|
|
|
implementation 'org.ow2.asm:asm-analysis:9.7.1'
|
|
|
|
|
|
implementation 'org.ow2.asm:asm-util:9.7.1'
|
|
|
|
|
|
implementation 'org.ow2.asm:asm-tree:9.7.1'
|
2025-02-14 09:45:11 +08:00
|
|
|
|
|
|
|
|
|
|
implementation 'org.jsoup:jsoup:1.17.2'
|
|
|
|
|
|
|
|
|
|
|
|
implementation 'com.google.code.gson:gson:2.8.9'
|
|
|
|
|
|
|
2025-02-21 20:55:10 +08:00
|
|
|
|
//implementation 'com.formdev:flatlaf:0.26'
|
|
|
|
|
|
implementation 'commons-io:commons-io:2.14.0'
|
|
|
|
|
|
|
|
|
|
|
|
implementation 'com.formdev:flatlaf:3.2.1' // FlatLaf核心
|
|
|
|
|
|
implementation 'com.formdev:flatlaf-extras:3.2.1' // 扩展组件
|
|
|
|
|
|
implementation 'com.formdev:flatlaf-intellij-themes:3.2.1' // 官方主题包
|
2025-02-22 15:53:32 +08:00
|
|
|
|
|
|
|
|
|
|
implementation 'org.python:jython-standalone:2.7.3'
|
|
|
|
|
|
|
2025-02-23 13:31:14 +08:00
|
|
|
|
implementation 'org.fxmisc.richtext:richtextfx:0.11.0' // 更新后的richtextfx
|
|
|
|
|
|
implementation 'org.bitbucket.mstrobel:procyon-core:0.5.36' // 使用JitPack版本
|
|
|
|
|
|
implementation 'org.bitbucket.mstrobel:procyon-compilertools:0.5.36'
|
|
|
|
|
|
|
2025-03-01 16:19:19 +08:00
|
|
|
|
// 必须的核心依赖
|
2025-03-01 19:51:57 +08:00
|
|
|
|
implementation 'com.fifesoft:rsyntaxtextarea:3.5.4'
|
2025-03-01 16:19:19 +08:00
|
|
|
|
|
|
|
|
|
|
// 可选UI增强
|
|
|
|
|
|
implementation 'com.fifesoft:rstaui:3.3.1'
|
2025-03-01 19:51:57 +08:00
|
|
|
|
implementation 'com.fifesoft:languagesupport:3.3.0'
|
|
|
|
|
|
implementation 'com.fifesoft:autocomplete:3.3.2'
|
2025-03-01 16:19:19 +08:00
|
|
|
|
|
2025-02-23 13:31:14 +08:00
|
|
|
|
implementation 'org.apache.commons:commons-compress:1.23.0'
|
|
|
|
|
|
implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.2'
|
|
|
|
|
|
implementation 'org.controlsfx:controlsfx:11.1.2' // 现代化UI组件
|
|
|
|
|
|
implementation 'com.dlsc.formsfx:formsfx-core:11.6.0' // 表单组件
|
|
|
|
|
|
implementation 'net.sourceforge.plantuml:plantuml:8059' // UML支持(可选)
|
|
|
|
|
|
|
2025-02-22 15:53:32 +08:00
|
|
|
|
implementation 'com.google.code.gson:gson:2.10.1'
|
2025-02-23 13:31:14 +08:00
|
|
|
|
|
|
|
|
|
|
implementation 'org.openjfx:javafx-controls:21'
|
|
|
|
|
|
implementation 'org.benf:cfr:0.152'
|
|
|
|
|
|
|
|
|
|
|
|
implementation 'com.github.javaparser:javaparser-core:3.25.1'
|
2025-03-01 16:19:19 +08:00
|
|
|
|
|
|
|
|
|
|
implementation 'org.springframework.boot:spring-boot-starter-web' // Web支持
|
|
|
|
|
|
implementation 'org.springframework.boot:spring-boot-starter-data-jpa' // JPA数据库支持
|
|
|
|
|
|
implementation 'org.springframework.boot:spring-boot-starter-validation' // 参数校验
|
|
|
|
|
|
|
|
|
|
|
|
// 安全相关依赖
|
|
|
|
|
|
implementation 'org.springframework.boot:spring-boot-starter-security' // Spring Security
|
|
|
|
|
|
implementation 'io.jsonwebtoken:jjwt-api:0.12.3' // JWT API
|
|
|
|
|
|
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.12.3', // JWT实现
|
|
|
|
|
|
'io.jsonwebtoken:jjwt-jackson:0.12.3' // JWT序列化
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
runtimeOnly 'com.mysql:mysql-connector-j'
|
|
|
|
|
|
|
|
|
|
|
|
// 开发工具
|
|
|
|
|
|
developmentOnly 'org.springframework.boot:spring-boot-devtools'
|
|
|
|
|
|
|
|
|
|
|
|
// 测试依赖
|
|
|
|
|
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
|
|
|
|
|
testImplementation 'org.springframework.security:spring-security-test'
|
|
|
|
|
|
|
2025-02-05 15:02:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-02-10 21:20:56 +08:00
|
|
|
|
// 分离依赖项到 libs 目录
|
|
|
|
|
|
task copyDependencies(type: Copy) {
|
|
|
|
|
|
from configurations.runtimeClasspath
|
|
|
|
|
|
into "$buildDir/libs/libs"
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 执行我生成jar
|
2025-02-09 12:06:50 +08:00
|
|
|
|
jar {
|
|
|
|
|
|
manifest {
|
2025-02-10 21:20:56 +08:00
|
|
|
|
attributes 'Main-Class': 'com.axis.innovators.box.Main',
|
|
|
|
|
|
'Class-Path': configurations.runtimeClasspath.files.collect { "libs/$it.name" }.join(' ')
|
|
|
|
|
|
}
|
|
|
|
|
|
dependsOn copyDependencies
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 测试配置
|
|
|
|
|
|
test {
|
|
|
|
|
|
useJUnitPlatform()
|
|
|
|
|
|
systemProperty "java.system.class.loader", "com.axis.innovators.box.plugins.BoxClassLoader"
|
|
|
|
|
|
|
|
|
|
|
|
// 确保测试能看到依赖
|
|
|
|
|
|
classpath = files(sourceSets.test.output) +
|
|
|
|
|
|
files("$buildDir/libs/libs") +
|
|
|
|
|
|
configurations.testRuntimeClasspath
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 处理开源文档文件
|
|
|
|
|
|
sourceSets {
|
|
|
|
|
|
main {
|
|
|
|
|
|
resources {
|
|
|
|
|
|
exclude '**/*.md'
|
|
|
|
|
|
}
|
2025-02-09 12:06:50 +08:00
|
|
|
|
}
|
2025-02-10 21:20:56 +08:00
|
|
|
|
openSourceDocs {
|
|
|
|
|
|
resources {
|
|
|
|
|
|
srcDir 'src/main/resources'
|
|
|
|
|
|
include '**/*.md'
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-02-11 13:21:45 +08:00
|
|
|
|
tasks.withType(JavaExec).configureEach {
|
|
|
|
|
|
jvmArgs = [
|
|
|
|
|
|
'-Djava.system.class.loader=com.axis.innovators.box.plugins.BoxClassLoader'
|
|
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-02-23 13:31:14 +08:00
|
|
|
|
javafx {
|
|
|
|
|
|
version = "21"
|
|
|
|
|
|
modules = [ 'javafx.controls', 'javafx.fxml' ]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-02-10 21:20:56 +08:00
|
|
|
|
// 单独打包文档
|
|
|
|
|
|
task packageOpenSourceDocs(type: Jar) {
|
|
|
|
|
|
archiveClassifier = 'docs'
|
|
|
|
|
|
from sourceSets.openSourceDocs.resources
|
|
|
|
|
|
destinationDirectory = file("$buildDir/libs/docs")
|
2025-02-06 20:49:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-02-10 21:20:56 +08:00
|
|
|
|
// 完整的 application 配置
|
2025-02-10 15:32:22 +08:00
|
|
|
|
application {
|
|
|
|
|
|
mainClass = 'com.axis.innovators.box.Main'
|
2025-02-10 21:20:56 +08:00
|
|
|
|
|
|
|
|
|
|
// 确保运行时参数生效
|
2025-02-10 15:32:22 +08:00
|
|
|
|
applicationDefaultJvmArgs = [
|
2025-02-10 21:20:56 +08:00
|
|
|
|
"-Djava.system.class.loader=com.axis.innovators.box.plugins.BoxClassLoader",
|
2025-02-23 13:31:14 +08:00
|
|
|
|
"-Dloader.library.path=$buildDir/libs/libs",
|
|
|
|
|
|
'-Dfile.encoding=UTF-8'
|
2025-02-10 15:32:22 +08:00
|
|
|
|
]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-02-10 21:20:56 +08:00
|
|
|
|
// 创建可运行分发
|
|
|
|
|
|
tasks.register('release') {
|
|
|
|
|
|
dependsOn build, packageOpenSourceDocs
|
|
|
|
|
|
|
|
|
|
|
|
doLast {
|
|
|
|
|
|
copy {
|
|
|
|
|
|
from "$buildDir/libs"
|
|
|
|
|
|
into "$buildDir/dist"
|
|
|
|
|
|
include '*.jar'
|
|
|
|
|
|
include 'docs/**'
|
|
|
|
|
|
include 'libs/**'
|
|
|
|
|
|
}
|
|
|
|
|
|
println "Release package ready at: $buildDir/dist"
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 默认构建任务
|
|
|
|
|
|
build.dependsOn release
|