2026-02-09 17:45:06 +08:00
|
|
|
|
plugins {
|
|
|
|
|
|
id 'java'
|
|
|
|
|
|
id 'application'
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
group = 'org.example'
|
|
|
|
|
|
version = '1.0-SNAPSHOT'
|
|
|
|
|
|
|
2026-02-11 10:22:09 +08:00
|
|
|
|
// 设置 Java 版本兼容性
|
|
|
|
|
|
java {
|
|
|
|
|
|
sourceCompatibility = JavaVersion.VERSION_11
|
|
|
|
|
|
targetCompatibility = JavaVersion.VERSION_11
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-09 17:45:06 +08:00
|
|
|
|
repositories {
|
|
|
|
|
|
mavenCentral()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
|
|
implementation ('org.fisco-bcos.java-sdk:fisco-bcos-java-sdk:2.9.1')
|
|
|
|
|
|
|
|
|
|
|
|
// 添加日志实现,避免 SLF4J 警告
|
|
|
|
|
|
implementation 'org.slf4j:slf4j-simple:1.7.36'
|
|
|
|
|
|
|
|
|
|
|
|
testImplementation platform('org.junit:junit-bom:5.10.0')
|
|
|
|
|
|
testImplementation 'org.junit.jupiter:junit-jupiter'
|
|
|
|
|
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
test {
|
|
|
|
|
|
useJUnitPlatform()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
application {
|
2026-02-11 10:22:09 +08:00
|
|
|
|
mainClass = 'com.org.fisco.TPSTest'
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 创建 Fat JAR(包含所有依赖的可执行jar)
|
|
|
|
|
|
tasks.register('fatJar', Jar) {
|
|
|
|
|
|
archiveClassifier = 'all'
|
|
|
|
|
|
archiveFileName = 'tps-test.jar'
|
|
|
|
|
|
|
|
|
|
|
|
manifest {
|
|
|
|
|
|
attributes(
|
|
|
|
|
|
'Main-Class': 'com.org.fisco.TPSTest',
|
|
|
|
|
|
'Implementation-Title': 'FISCO BCOS TPS Test Tool',
|
|
|
|
|
|
'Implementation-Version': version
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 包含编译后的类
|
|
|
|
|
|
from sourceSets.main.output
|
|
|
|
|
|
|
|
|
|
|
|
// 包含所有运行时依赖
|
|
|
|
|
|
from {
|
|
|
|
|
|
configurations.runtimeClasspath.collect {
|
|
|
|
|
|
it.isDirectory() ? it : zipTree(it)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 排除签名文件
|
|
|
|
|
|
exclude 'META-INF/*.SF'
|
|
|
|
|
|
exclude 'META-INF/*.DSA'
|
|
|
|
|
|
exclude 'META-INF/*.RSA'
|
|
|
|
|
|
|
|
|
|
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 让 build 任务依赖 fatJar
|
|
|
|
|
|
build.dependsOn fatJar
|