build.gradle 1.72 KB
plugins {
    id 'org.springframework.boot' version '3.2.0' 
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'java'
}

group = 'com.ecommerce'
version = '1.0.0'
sourceCompatibility = '21'

repositories {
    mavenCentral()
}

ext {
    set('springCloudVersion', "2021.0.3")
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-validation'
    implementation 'org.springframework.boot:spring-boot-starter-data-redis'
    implementation 'org.springframework.boot:spring-boot-starter-actuator'
    implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
    implementation 'org.springframework.boot:spring-boot-starter-cache'
    
    // Database
    runtimeOnly 'org.postgresql:postgresql'
    
    // Flyway - 数据库迁移
    implementation 'org.flywaydb:flyway-core'
    
    // JSONB support for PostgreSQL
    implementation 'com.vladmihalcea:hibernate-types-55:2.16.2'
    
    // Swagger/OpenAPI
    implementation 'org.springdoc:springdoc-openapi-ui:1.6.9'
    
    // Lombok - 升级到与 JDK 21 兼容的版本
    compileOnly 'org.projectlombok:lombok:1.18.30'
    annotationProcessor 'org.projectlombok:lombok:1.18.30'
    
    // Testing
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'org.springframework.security:spring-security-test'
}

dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
    }
}

test {
    useJUnitPlatform()
}

bootJar {
    archiveFileName = 'product-service.jar'
}