import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {

id 'org.springframework.boot' version '3.1.5'
id 'io.spring.dependency-management' version '1.1.3'
id 'org.jetbrains.kotlin.jvm' version '1.8.22'
id 'java'
id 'org.jetbrains.kotlin.plugin.spring' version '1.8.22'

}
sourceSets {

main {
    java {
        // 同时包含Java和Kotlin源码(Kotlin文件会被Kotlin插件处理)
        srcDirs = ['src/main/java', 'src/main/kotlin']
    }
    // 移除单独的kotlin源集配置,避免冲突
}

}

springBoot {

mainClass = 'com.kd.datacenter.DataCenterApplicationKt'  // Kotlin主类后缀是Kt

}

group = 'com.example'
version = '0.0.1-SNAPSHOT'

java {

sourceCompatibility = '17'

}

repositories {

mavenCentral()

}

dependencies {

implementation("org.springframework.boot:spring-boot-starter")
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin'
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
implementation 'org.apache.httpcomponents:httpclient:4.5.14'

// https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml

implementation('org.apache.poi:poi-ooxml:3.15')

// https://mvnrepository.com/artifact/com.google.guava/guava

implementation("com.google.guava:guava:33.4.8-jre")
// https://mvnrepository.com/artifact/jakarta.servlet/jakarta.servlet-api
compileOnly("jakarta.servlet:jakarta.servlet-api:6.1.0")
implementation 'org.jetbrains.kotlin:kotlin-reflect'
implementation 'org.apache.logging.log4j:log4j-core:2.21.1'
// https://mvnrepository.com/artifact/io.github.biezhi/TinyPinyin
implementation("io.github.biezhi:TinyPinyin:2.0.3.RELEASE")
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0'
implementation("com.squareup.okhttp3:okhttp:4.12.0")
// https://mvnrepository.com/artifact/org.apache.commons/commons-compress
implementation group: 'org.apache.commons', name: 'commons-compress', version: '1.24.0'
implementation 'com.dameng:Dm7JdbcDriver16:7.6.0.165'

// https://mvnrepository.com/artifact/com.github.mwiede/jsch

implementation group: 'com.github.mwiede', name: 'jsch', version: '0.2.17'
implementation 'com.baomidou:mybatis-plus-boot-starter:3.5.4.1'
implementation 'com.dameng:DmDialect-for-hibernate4.0:7.6.0.165'
implementation 'cn.hutool:hutool-all:5.8.23'
compileOnly 'org.projectlombok:lombok:1.18.30'
testImplementation 'org.springframework.boot:spring-boot-starter-test'

}

tasks.withType(KotlinCompile) {

kotlinOptions {
    freeCompilerArgs += '-Xjsr305=strict'
    jvmTarget = '17'
}

}

tasks.named('test') {

useJUnitPlatform()

}

最后修改:2025 年 08 月 22 日
如果觉得我的文章对你有用,请随意赞赏