API数据源示例
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.

54 lines
1.4 KiB

import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
plugins {
java
application
id("com.github.johnrengelman.shadow") version "5.2.0"
}
group = "com.fanruan.hihidata"
version = "1.0-SNAPSHOT"
tasks.withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
}
application {
mainClassName = "com.fanruan.hihidata.datasource.server.ServerApplication"
}
repositories {
mavenCentral()
maven(url = "https://mvn.fanruan.com/repository/maven-public/")
}
dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
implementation("com.google.guava:guava:31.1-jre")
implementation("org.jetbrains:annotations:23.0.0")
implementation("org.json:json:20220320")
implementation("org.apache.httpcomponents:httpclient:4.5.13")
testImplementation("junit:junit:4.12")
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
fun now(): String {
val current = LocalDateTime.now()
val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")
return current.format(formatter)
}
tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
archiveClassifier.set("fat")
manifest {
attributes(mapOf("Specification-Version" to now()))
}
}
tasks.withType<AbstractArchiveTask> {
setProperty("archiveFileName", "api-datasource-server.jar")
}