plugins {
	id "eclipse"
	id "java"
	id "org.asciidoctor.jvm.convert" version "3.3.2"
	id "org.springframework.boot" version "2.4.7"
}

apply plugin: 'io.spring.dependency-management'

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

group = 'com.example'

sourceCompatibility = 17
targetCompatibility = 17

ext {
	snippetsDir = file('build/generated-snippets')
}

ext['spring-restdocs.version'] = '3.0.0-SNAPSHOT'
ext['rest-assured.version'] = '4.4.0'
ext['groovy.version'] = '3.0.8'

configurations {
	asciidoctorExtensions
}

dependencies {
	asciidoctorExtensions 'org.springframework.restdocs:spring-restdocs-asciidoctor'

	implementation 'org.springframework.boot:spring-boot-starter-web'

	testImplementation 'io.rest-assured:rest-assured:4.4.0'
	testImplementation('org.junit.vintage:junit-vintage-engine') {
		exclude group: 'org.hamcrest', module: 'hamcrest-core'
	}
	testImplementation 'org.springframework.boot:spring-boot-starter-test'
	testImplementation 'org.springframework.restdocs:spring-restdocs-restassured'
}

test {
	outputs.dir snippetsDir
}

asciidoctor {
	configurations "asciidoctorExtensions"
	inputs.dir snippetsDir
	dependsOn test
}

bootJar {
	dependsOn asciidoctor
	from ("${asciidoctor.outputDir}/html5") {
		into 'static/docs'
	}
}

eclipseJdt.onlyIf { false }
cleanEclipseJdt.onlyIf { false }
