V1.0版本。1.修改打包方式 2.步骤2生成地址文件重复报错且报错不精准问题3.完善好的“用户使用说明书.pdf"
This commit is contained in:
parent
df39df55d7
commit
d1608666db
86
build.gradle
86
build.gradle
|
|
@ -8,6 +8,7 @@ buildscript {
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
|
id 'com.github.johnrengelman.shadow' version '8.1.1'
|
||||||
id 'java'
|
id 'java'
|
||||||
id 'io.franzbecker.gradle-lombok' version '3.0.0'
|
id 'io.franzbecker.gradle-lombok' version '3.0.0'
|
||||||
id 'application'
|
id 'application'
|
||||||
|
|
@ -65,14 +66,24 @@ dependencies {
|
||||||
|
|
||||||
implementation 'ch.qos.logback:logback-classic:1.5.18'
|
implementation 'ch.qos.logback:logback-classic:1.5.18'
|
||||||
implementation 'ch.qos.logback:logback-core:1.5.18'
|
implementation 'ch.qos.logback:logback-core:1.5.18'
|
||||||
implementation 'ch.qos.logback:logback-classic:1.5.6'
|
|
||||||
implementation 'commons-cli:commons-cli:1.9.0'
|
implementation 'commons-cli:commons-cli:1.9.0'
|
||||||
implementation 'com.alibaba:easyexcel:4.0.3'
|
implementation 'com.alibaba:easyexcel:4.0.3'
|
||||||
implementation 'org.apache.pdfbox:pdfbox:3.0.5'
|
implementation 'org.apache.pdfbox:pdfbox:3.0.5'
|
||||||
implementation 'com.github.albfernandez:javadbf:1.14.1'
|
implementation 'com.github.albfernandez:javadbf:1.14.1'
|
||||||
implementation 'org.apache.poi:poi-ooxml:5.4.1'
|
implementation 'org.apache.poi:poi-ooxml:5.4.1'
|
||||||
implementation 'com.intellij:annotations:12.0'
|
implementation 'com.intellij:annotations:12.0'
|
||||||
|
|
||||||
|
// ofdrw 核心库
|
||||||
|
implementation 'org.ofdrw:ofdrw-core:2.3.7'
|
||||||
|
implementation 'org.ofdrw:ofdrw-pkg:2.3.7'
|
||||||
implementation 'org.ofdrw:ofdrw-reader:2.3.7'
|
implementation 'org.ofdrw:ofdrw-reader:2.3.7'
|
||||||
|
|
||||||
|
// 第三方依赖
|
||||||
|
implementation 'dom4j:dom4j:1.6.1'
|
||||||
|
implementation 'org.bouncycastle:bcpkix-jdk18on:1.77' // 注意:版本可能需要调整
|
||||||
|
implementation 'commons-io:commons-io:2.11.0'
|
||||||
|
|
||||||
compileOnly 'org.projectlombok:lombok:1.18.38'
|
compileOnly 'org.projectlombok:lombok:1.18.38'
|
||||||
annotationProcessor 'org.projectlombok:lombok:1.18.38'
|
annotationProcessor 'org.projectlombok:lombok:1.18.38'
|
||||||
|
|
||||||
|
|
@ -83,10 +94,35 @@ dependencies {
|
||||||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
|
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ... application 块 ...
|
||||||
application {
|
application {
|
||||||
// 取消模块化,去掉 mainModule
|
// 取消模块化,去掉 mainModule
|
||||||
mainClass = 'top.r3944realms.docchecktoolrefactored.Main'
|
mainClass = 'top.r3944realms.docchecktoolrefactored.Main'
|
||||||
}
|
}
|
||||||
|
// 配置 Shadow-JAR 任务 第三方依赖的签名文件(.SF、.RSA)在 Fat-JAR 中冲突,导致 JVM 验证失败
|
||||||
|
shadowJar {
|
||||||
|
// 设置生成的 Jar 包名称
|
||||||
|
archiveBaseName.set(project_name)
|
||||||
|
archiveVersion.set(project_version)
|
||||||
|
|
||||||
|
// 指定主类,这样可以直接用 java -jar 运行
|
||||||
|
manifest {
|
||||||
|
attributes 'Main-Class': application.mainClass.get()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 合并服务文件(例如 SPI 配置),对某些库很重要
|
||||||
|
mergeServiceFiles()
|
||||||
|
|
||||||
|
// 核心修复:排除所有签名文件,解决 "Invalid signature file digest" 错误
|
||||||
|
exclude 'META-INF/*.SF'
|
||||||
|
exclude 'META-INF/*.RSA'
|
||||||
|
exclude 'META-INF/*.DSA'
|
||||||
|
}
|
||||||
|
|
||||||
|
// 让 build 任务依赖 shadowJar,这样执行 ./gradlew build 时也会生成 Fat-JAR
|
||||||
|
build.dependsOn shadowJar
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
javafx {
|
javafx {
|
||||||
version = javafxVersion
|
version = javafxVersion
|
||||||
|
|
@ -131,26 +167,7 @@ tasks.register('runCli', JavaExec) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 可选:创建生成可执行JAR的任务
|
|
||||||
tasks.register('buildFatJar', Jar) {
|
|
||||||
group = 'build'
|
|
||||||
description = 'Builds a standalone JAR with all dependencies'
|
|
||||||
|
|
||||||
manifest {
|
|
||||||
attributes(
|
|
||||||
'Main-Class': 'top.r3944realms.docchecktoolrefactored.Main'
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
from {
|
|
||||||
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
|
|
||||||
}
|
|
||||||
with jar // 继承主 jar 的内容
|
|
||||||
|
|
||||||
archiveBaseName.set(project_name)
|
|
||||||
archiveVersion.set(project_version)
|
|
||||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
||||||
}
|
|
||||||
|
|
||||||
// =================== 轻便版打包 ===================
|
// =================== 轻便版打包 ===================
|
||||||
|
|
||||||
|
|
@ -158,14 +175,24 @@ tasks.register('buildPortable', Exec) {
|
||||||
group = 'distribution'
|
group = 'distribution'
|
||||||
description = 'Build portable EXE (no installer)'
|
description = 'Build portable EXE (no installer)'
|
||||||
|
|
||||||
dependsOn buildFatJar
|
// 依赖 shadowJar 任务,而不是 buildFatJar
|
||||||
|
dependsOn shadowJar
|
||||||
|
|
||||||
|
doFirst {
|
||||||
|
mkdir "$buildDir/distributions"
|
||||||
|
|
||||||
|
// 打印出生成的 shadow JAR 信息,方便确认
|
||||||
|
def shadowJarFile = shadowJar.archiveFile.get().asFile
|
||||||
|
println "Using shadow JAR for packaging: ${shadowJarFile.name}"
|
||||||
|
println "Location: ${shadowJarFile.parent}"
|
||||||
|
}
|
||||||
|
|
||||||
commandLine 'jpackage',
|
commandLine 'jpackage',
|
||||||
'--name', 'DocCheckTool',
|
'--name', project_name, // 使用 project_name 属性
|
||||||
'--input', "$buildDir/libs",
|
'--input', shadowJar.archiveFile.get().asFile.parent, // shadow JAR 所在的目录
|
||||||
'--main-jar', "${project_name}-${project_version}.jar",
|
'--main-jar', shadowJar.archiveFileName.get(), // shadow JAR 的文件名
|
||||||
'--main-class', application.mainClass.get(),
|
'--main-class', application.mainClass.get(),
|
||||||
'--type', 'app-image', // ⚠️ 轻便版不生成安装器
|
'--type', 'app-image',
|
||||||
'--app-version', project_version,
|
'--app-version', project_version,
|
||||||
'--vendor', 'r3944realms',
|
'--vendor', 'r3944realms',
|
||||||
'--dest', "$buildDir/distributions",
|
'--dest', "$buildDir/distributions",
|
||||||
|
|
@ -174,8 +201,9 @@ tasks.register('buildPortable', Exec) {
|
||||||
'--java-options', '-Xms256m',
|
'--java-options', '-Xms256m',
|
||||||
'--verbose',
|
'--verbose',
|
||||||
'--icon', file('src/main/resources/img/logo256x.ico').absolutePath
|
'--icon', file('src/main/resources/img/logo256x.ico').absolutePath
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
doFirst {
|
|
||||||
mkdir "$buildDir/distributions"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
project_group =top.r3944realms.docchecktoolrefacored
|
project_group =top.r3944realms.docchecktoolrefacored
|
||||||
project_name = doc-check-tool
|
project_name = doc-check-tool
|
||||||
project_version = 1.0.0.5
|
project_version = 1.0
|
||||||
|
|
@ -108,12 +108,12 @@ public class ExcelFileReader implements CatalogFileReader {
|
||||||
|
|
||||||
// 验证数据有效性
|
// 验证数据有效性
|
||||||
if (archiveCode.isEmpty()) {
|
if (archiveCode.isEmpty()) {
|
||||||
DialogUtil.showWarningDialog("警告", "操作有误", "第" + ( i + 1 ) + "行档号为空,停止处理");
|
|
||||||
throw new IllegalArgumentException("第" + ( i + 1 ) + "行档号为空,停止处理");
|
throw new IllegalArgumentException("第" + ( i + 1 ) + "行档号为空,停止处理");
|
||||||
|
|
||||||
}
|
}
|
||||||
if (page <= 0) {
|
if (page <= 0) {
|
||||||
DialogUtil.showWarningDialog("警告", "操作有误", "第" + ( i + 1 ) + "第" + ( i + 1 ) + "行页数无效: " + page + ",停止处理");
|
|
||||||
throw new IllegalArgumentException("第" + ( i + 1 ) + "行页数无效: " + page + ",停止处理");
|
throw new IllegalArgumentException("第" + ( i + 1 ) + "行页数无效: " + page + ",停止处理");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -212,9 +212,9 @@ public class MainStageController {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 帮助文档在资源中的路径
|
// 帮助文档在资源中的路径
|
||||||
private static final String HELP_DOC_RESOURCE_PATH = "/docs/UserHelpDocument.docx";
|
private static final String HELP_DOC_RESOURCE_PATH = "/docs/UserHelpDocument.pdf";
|
||||||
// 释放到外部的文件名
|
// 释放到外部的文件名
|
||||||
private static final String HELP_DOC_FILE_NAME = "操作手册.docx";
|
private static final String HELP_DOC_FILE_NAME = "用户使用说明书.pdf";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 使用系统默认程序打开文档
|
* 使用系统默认程序打开文档
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ public class AddressFileGenerationTask extends Task<String> {
|
||||||
outputFile.delete();// 删除空内容的csv文件
|
outputFile.delete();// 删除空内容的csv文件
|
||||||
throw e; // 直接抛出,保留原始消息
|
throw e; // 直接抛出,保留原始消息
|
||||||
}
|
}
|
||||||
throw new RuntimeException("地址文件生成失败", e);
|
throw e;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
BIN
src/main/resources/docs/UserHelpDocument.pdf
Normal file
BIN
src/main/resources/docs/UserHelpDocument.pdf
Normal file
Binary file not shown.
BIN
用户使用说明书.pdf
Normal file
BIN
用户使用说明书.pdf
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user