V1.0版本。1.修改打包方式 2.步骤2生成地址文件重复报错且报错不精准问题3.完善好的“用户使用说明书.pdf"

This commit is contained in:
CXT-maker 2025-11-24 14:36:28 +08:00
parent df39df55d7
commit d1608666db
8 changed files with 63 additions and 35 deletions

View File

@ -8,6 +8,7 @@ buildscript {
}
plugins {
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'java'
id 'io.franzbecker.gradle-lombok' version '3.0.0'
id 'application'
@ -65,14 +66,24 @@ dependencies {
implementation 'ch.qos.logback:logback-classic: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 'com.alibaba:easyexcel:4.0.3'
implementation 'org.apache.pdfbox:pdfbox:3.0.5'
implementation 'com.github.albfernandez:javadbf:1.14.1'
implementation 'org.apache.poi:poi-ooxml:5.4.1'
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 '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'
annotationProcessor 'org.projectlombok:lombok:1.18.38'
@ -83,10 +94,35 @@ dependencies {
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
}
// ... application ...
application {
// mainModule
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 {
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'
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',
'--name', 'DocCheckTool',
'--input', "$buildDir/libs",
'--main-jar', "${project_name}-${project_version}.jar",
'--name', project_name, // 使 project_name
'--input', shadowJar.archiveFile.get().asFile.parent, // shadow JAR
'--main-jar', shadowJar.archiveFileName.get(), // shadow JAR
'--main-class', application.mainClass.get(),
'--type', 'app-image', // 便
'--type', 'app-image',
'--app-version', project_version,
'--vendor', 'r3944realms',
'--dest', "$buildDir/distributions",
@ -174,8 +201,9 @@ tasks.register('buildPortable', Exec) {
'--java-options', '-Xms256m',
'--verbose',
'--icon', file('src/main/resources/img/logo256x.ico').absolutePath
doFirst {
mkdir "$buildDir/distributions"
}
}

View File

@ -1,3 +1,3 @@
project_group =top.r3944realms.docchecktoolrefacored
project_name = doc-check-tool
project_version = 1.0.0.5
project_version = 1.0

View File

@ -108,12 +108,12 @@ public class ExcelFileReader implements CatalogFileReader {
// 验证数据有效性
if (archiveCode.isEmpty()) {
DialogUtil.showWarningDialog("警告", "操作有误", "" + ( i + 1 ) + "行档号为空,停止处理");
throw new IllegalArgumentException("" + ( i + 1 ) + "行档号为空,停止处理");
}
if (page <= 0) {
DialogUtil.showWarningDialog("警告", "操作有误", "" + ( i + 1 ) + "" + ( i + 1 ) + "行页数无效: " + page + ",停止处理");
throw new IllegalArgumentException("" + ( i + 1 ) + "行页数无效: " + page + ",停止处理");
}

View File

@ -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";
/**
* 使用系统默认程序打开文档

View File

@ -84,7 +84,7 @@ public class AddressFileGenerationTask extends Task<String> {
outputFile.delete();// 删除空内容的csv文件
throw e; // 直接抛出保留原始消息
}
throw new RuntimeException("地址文件生成失败", e);
throw e;
}
});

Binary file not shown.

BIN
用户使用说明书.pdf Normal file

Binary file not shown.