<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>io.imunity.furms</groupId>
		<artifactId>furms-parent</artifactId>
		<version>0.0.1-a1</version>
	</parent>
	<artifactId>furms-doc</artifactId>
	<name>furms-doc</name>
	<description>FURMS Documentation</description>

	<scm>
		<connection>${scm.base}/furms-doc</connection>
		<developerConnection>${scm.base}/furms-doc</developerConnection>
		<tag>furms-release-0.0.1-a1</tag>
	</scm>

	<properties>
		<asciidoctor.maven.plugin.version>2.1.0</asciidoctor.maven.plugin.version>
		<asciidoctorj.version>2.4.1</asciidoctorj.version>
		<jruby.version>9.2.13.0</jruby.version>
		<sonar.skip>true</sonar.skip>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
			<exclusions>
				<exclusion>
					<groupId>org.springframework.boot</groupId>
					<artifactId>spring-boot-starter-tomcat</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-jetty</artifactId>
		</dependency>
		<dependency>
			<groupId>io.imunity.furms</groupId>
			<artifactId>furms-rest-api</artifactId>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.springdoc</groupId>
			<artifactId>springdoc-openapi-ui</artifactId>
		</dependency>
	</dependencies>

	<build>
		<defaultGoal>process-resources</defaultGoal>
		<plugins>
			<plugin>
				<groupId>org.asciidoctor</groupId>
				<artifactId>asciidoctor-maven-plugin</artifactId>
				<version>${asciidoctor.maven.plugin.version}</version>
				<dependencies>
					<dependency>
						<groupId>org.jruby</groupId>
						<artifactId>jruby-complete</artifactId>
						<version>${jruby.version}</version>
					</dependency>
					<dependency>
						<groupId>org.asciidoctor</groupId>
						<artifactId>asciidoctorj</artifactId>
						<version>${asciidoctorj.version}</version>
					</dependency>
				</dependencies>
				<configuration>
					<sourceDirectory>src/docs/asciidoc</sourceDirectory>
					<attributes>
						<endpoint-url>http://example.org</endpoint-url>
						<sourcedir>${project.build.sourceDirectory}</sourcedir>
						<project-version>${project.version}</project-version>
					</attributes>
				</configuration>
				<executions>
					<execution>
						<id>asciidoc-to-html</id>
						<phase>generate-resources</phase>
						<goals>
							<goal>process-asciidoc</goal>
						</goals>
						<configuration>
							<backend>html5</backend>
							<attributes>
								<source-highlighter>coderay</source-highlighter>
								<imagesdir>./images</imagesdir>
								<toc>left</toc>
								<icons>font</icons>
								<sectanchors>true</sectanchors>
								<idprefix /> <!-- set the idprefix to blank -->
								<idseparator>-</idseparator>
								<docinfo1>true</docinfo1>
								<doctype>book</doctype>
							</attributes>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-resources-plugin</artifactId>
				<executions>
					<execution>
						<id>copy-asciidoc-resources</id>
						<phase>process-resources</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<resources>
								<resource>
									<directory>src/docs/resources</directory>
									<includes>
										<include>**/*.jpg</include>
										<include>**/*.png</include>
									</includes>
								</resource>
							</resources>
							<outputDirectory>target/generated-docs</outputDirectory>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

	<profiles>
		<profile>
			<id>springdoc</id>
			<build>
				<resources>
					<resource>
						<directory>${basedir}/src/main/resources</directory>
						<filtering>true</filtering>
						<includes>
							<include>**/application*.yml</include>
						</includes>
					</resource>
				</resources>

				<plugins>
					<plugin>
						<groupId>org.springframework.boot</groupId>
						<artifactId>spring-boot-maven-plugin</artifactId>
						<configuration>
							<profiles>
								<profile>springdoc</profile>
							</profiles>
						</configuration>
						<executions>
							<execution>
								<id>pre-integration-test</id>
								<goals>
									<goal>start</goal>
								</goals>
								<configuration>
									<arguments>
										<argument>--server.port=3443</argument>
									</arguments>
								</configuration>
							</execution>
							<execution>
								<id>post-integration-test</id>
								<goals>
									<goal>stop</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.springdoc</groupId>
						<artifactId>springdoc-openapi-maven-plugin</artifactId>
						<executions>
							<execution>
								<phase>integration-test</phase>
								<goals>
									<goal>generate</goal>
								</goals>
							</execution>
						</executions>
						<configuration>
							<apiDocsUrl>http://localhost:3443/api-docs</apiDocsUrl>
							<outputFileName>openapi.json</outputFileName>
							<outputDir>${project.build.directory}</outputDir>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>
</project>