You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
98 lines
2.2 KiB
98 lines
2.2 KiB
plugins {
|
|
id 'java'
|
|
id 'application'
|
|
id 'jacoco'
|
|
}
|
|
|
|
group = 'com.smartlibrary'
|
|
version = '1.11.0'
|
|
|
|
// 支持Jenkins构建号
|
|
def buildNumber = project.findProperty('buildNumber') ?: '0'
|
|
def fullVersion = "v${version}.${buildNumber}"
|
|
|
|
java {
|
|
sourceCompatibility = JavaVersion.VERSION_21
|
|
targetCompatibility = JavaVersion.VERSION_21
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
dependencies {
|
|
implementation project(':core')
|
|
|
|
// 日志依赖
|
|
implementation 'org.slf4j:slf4j-api:2.0.9'
|
|
implementation 'ch.qos.logback:logback-classic:1.4.14'
|
|
|
|
// 测试依赖
|
|
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.1'
|
|
testImplementation 'org.mockito:mockito-core:5.8.0'
|
|
testImplementation 'org.mockito:mockito-junit-jupiter:5.8.0'
|
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
|
}
|
|
|
|
tasks.named('test') {
|
|
useJUnitPlatform()
|
|
testLogging {
|
|
events "passed", "skipped", "failed"
|
|
}
|
|
finalizedBy jacocoTestReport
|
|
}
|
|
|
|
jacocoTestReport {
|
|
dependsOn test
|
|
reports {
|
|
xml.required = true
|
|
html.required = true
|
|
}
|
|
}
|
|
|
|
application {
|
|
mainClass = 'com.smartlibrary.cli.CLIApplication'
|
|
}
|
|
|
|
// 允许交互式输入
|
|
run {
|
|
standardInput = System.in
|
|
}
|
|
|
|
// Fat JAR 任务
|
|
tasks.register('fatJar', Jar) {
|
|
dependsOn ':core:jar'
|
|
archiveBaseName = 'mcslms-cli'
|
|
archiveVersion = fullVersion
|
|
archiveClassifier = 'all'
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
manifest {
|
|
attributes(
|
|
'Main-Class': 'com.smartlibrary.cli.CLIApplication',
|
|
'Implementation-Title': 'Smart Library CLI',
|
|
'Implementation-Version': version
|
|
)
|
|
}
|
|
from {
|
|
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
|
|
}
|
|
with jar
|
|
// 排除签名文件,避免 SecurityException
|
|
exclude 'META-INF/*.SF'
|
|
exclude 'META-INF/*.DSA'
|
|
exclude 'META-INF/*.RSA'
|
|
}
|
|
|
|
jar {
|
|
archiveBaseName = 'mcslms-cli'
|
|
archiveVersion = fullVersion
|
|
manifest {
|
|
attributes(
|
|
'Main-Class': 'com.smartlibrary.cli.CLIApplication',
|
|
'Implementation-Title': 'Smart Library CLI',
|
|
'Implementation-Version': fullVersion
|
|
)
|
|
}
|
|
}
|
|
|