PIbd-23_Forsov_KA_IP_Online.../laba3.1/Лекция4-src/build.gradle

68 lines
1.6 KiB
Groovy
Raw Permalink Normal View History

plugins {
id 'java'
id 'org.springframework.boot' version '3.2.4'
id 'io.spring.dependency-management' version '1.1.4'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
defaultTasks 'bootRun'
ext {
springProfiles = []
if (project.hasProperty('prod')) {
springProfiles.add('prod')
} else {
springProfiles.add('dev')
}
}
bootRun {
def currentProfiles = springProfiles.join(',')
println('Current profiles are: ' + currentProfiles)
def currentArgs = ['--spring.profiles.active=' + currentProfiles]
if (project.hasProperty('args')) {
currentArgs.addAll(project.args.split(','))
}
args currentArgs
}
jar {
enabled = false
}
bootJar {
archiveFileName = String.format('%s-%s.jar', rootProject.name, version)
}
assert System.properties['java.specification.version'] == '17' || '21'
java {
sourceCompatibility = '17'
}
repositories {
mavenCentral()
}
dependencies {
if (project.hasProperty('prod')) {
implementation 'org.postgresql:postgresql:42.7.3'
} else {
implementation 'com.h2database:h2:2.2.224'
}
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.3.0'
implementation 'org.modelmapper:modelmapper:3.2.0'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.liquibase:liquibase-core:4.26.0'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
tasks.named('test') {
useJUnitPlatform()
}