Newer
Older
job-tracker / build.gradle
plugins {
    id 'java'
    id 'org.springframework.boot' version '3.2.5'
    id 'io.spring.dependency-management' version '1.1.4'
    id 'com.github.node-gradle.node' version '7.0.2'
}

group = 'com.kpaudel'
version = '1.0-SNAPSHOT'

java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(21)
    }
}
repositories {
    mavenCentral()
}

dependencies {
    // Spring Boot starters
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'

    // Database driver
    runtimeOnly 'org.postgresql:postgresql:42.7.3'

    // Database migration
    implementation 'org.flywaydb:flyway-core:10.13.0'
    implementation 'org.flywaydb:flyway-database-postgresql:10.13.0'

    // Optional: JSON serialization tweaks
    implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'

    // Lombok (optional convenience)
    compileOnly 'org.projectlombok:lombok'
    annotationProcessor 'org.projectlombok:lombok'
    // Exporting to CSV
    implementation 'com.opencsv:opencsv:5.9'


    // Testing
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'org.testcontainers:junit-jupiter'
    testImplementation 'org.testcontainers:postgresql'
}

tasks.named('test') {
    useJUnitPlatform()
}

// ===== FRONTEND BUILD INTEGRATION ====
def frontendDir = "${projectDir}/frontend"

node {
    version = "20.11.0"
    npmVersion = "10.2.4"
    download = true
    workDir = file(layout.buildDirectory.dir("nodejs"))
    npmWorkDir = file(layout.buildDirectory.dir("npm"))
}


task buildFrontend(type: NpmTask) {
    dependsOn tasks.npmInstall
    workingDir = file(frontendDir)
    args = ["run", "build"]

}

task copyFrontend(type: Copy) {
    dependsOn buildFrontend
    from("${frontendDir}/build")
    into(layout.buildDirectory.dir("resources/main/static"))
}

tasks.named("processResources") {
    dependsOn copyFrontend
}