plugins {
	id 'org.springframework.boot' version '2.6.3'
	id 'io.spring.dependency-management' version '1.0.11.RELEASE'
	id 'org.asciidoctor.jvm.convert' version '3.3.2'
	id 'java'
}

group = 'com.just-pickup'
version = '1.0'
sourceCompatibility = '11'
configurations {
	compileOnly {
		extendsFrom annotationProcessor
	}
	asciidoctorExtensions
}

repositories {
	mavenCentral()
	maven { url 'https://repo.spring.io/milestone' }
}

ext {
	set('snippetsDir', file("build/generated-snippets"))
	set('springCloudVersion', "2021.0.0")
}

dependencies {
	implementation 'org.springframework.boot:spring-boot-starter-actuator'
	implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
	implementation 'org.springframework.boot:spring-boot-starter-validation'
	implementation 'org.springframework.boot:spring-boot-starter-web'
	implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
	implementation 'org.springframework.cloud:spring-cloud-starter-openfeign'
	implementation 'org.springframework.cloud:spring-cloud-starter-config'
	implementation 'org.springframework.kafka:spring-kafka'
	// https://mvnrepository.com/artifact/com.github.gavlyukovskiy/p6spy-spring-boot-starter
	implementation 'com.github.gavlyukovskiy:p6spy-spring-boot-starter:1.8.0'
	// zipkin & sleuth
	implementation 'org.springframework.cloud:spring-cloud-starter-sleuth'
	implementation 'org.springframework.cloud:spring-cloud-starter-zipkin:2.2.3.RELEASE'

	compileOnly 'org.projectlombok:lombok'
	developmentOnly 'org.springframework.boot:spring-boot-devtools'
	runtimeOnly 'org.postgresql:postgresql'
	annotationProcessor 'org.projectlombok:lombok'
	testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'org.springframework.kafka:spring-kafka-test'
	testImplementation 'com.h2database:h2'

	testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
	// operation block 을 위한 의존성
	asciidoctorExtensions 'org.springframework.restdocs:spring-restdocs-asciidoctor'

	// Querydsl
	implementation 'com.querydsl:querydsl-jpa'
	// Querydsl JPAAnnotationProcessor 사용 지정
	annotationProcessor "com.querydsl:querydsl-apt:5.0.0:jpa"
	// java.lang.NoClassDefFoundError(javax.annotation.Entity) 발생 대응
	annotationProcessor "jakarta.persistence:jakarta.persistence-api"
	// java.lang.NoClassDefFoundError(javax.annotation.Generated) 발생 대응
	annotationProcessor "jakarta.annotation:jakarta.annotation-api"



}

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

test {
	outputs.dir snippetsDir
	useJUnitPlatform()
}

asciidoctor {
	configurations 'asciidoctorExtensions'
	attributes 'snippets': snippetsDir
	dependsOn test
}

bootJar {
	dependsOn asciidoctor
	copy {
		from "${asciidoctor.outputDir}"
		into 'src/main/resources/static/docs'
	}
}

// clean task 실행시 QClass 삭제
clean {
	delete file('src/main/generated') // 인텔리제이 Annotation processor 생성물 생성 위치
}