<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>
	<groupId>com.ontimize</groupId>
	<artifactId>ontimize-openapi-generator</artifactId>
	<version>1.0.4</version>
	<packaging>maven-plugin</packaging>
	<organization>
		<name>Imatia Innovation</name>
		<url>http://imatia.com</url>
	</organization>

	<name>Ontimize OpenAPI Generator</name>
	<description>This plugin gives you the ability to generate source code to implement Open API specifications as part of your build.</description>
	<url>https://www.ontimize.com</url>

	<developers>
		<developer>
			<name>Xoán Loureiro Santamaría</name>
			<email>xoan.loureiro@imatia.com</email>
			<organization>Imatia Innovation</organization>
			<organizationUrl>http://imatia.com</organizationUrl>
		</developer>
	</developers>

	<licenses>
		<license>
			<name>The Apache License, Version 2.0</name>
			<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
		</license>
	</licenses>

	<scm>
		<connection>scm:git:git://github.com/ontimize/ontimize-openapi-generator.git</connection>
		<developerConnection>scm:git:ssh://github.com:ontimize/ontimize-openapi-generator.git</developerConnection>
		<url>https://github.com/ontimize/ontimize-openapi-generator/tree/master</url>
	</scm>

	<distributionManagement>
		<snapshotRepository>
			<id>ossrh</id>
			<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
		</snapshotRepository>
		<repository>
			<id>ossrh</id>
			<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
		</repository>
	</distributionManagement>

	<properties>
		<maven.compiler.target>11</maven.compiler.target>
		<maven.compiler.source>11</maven.compiler.source>

		<!-- =========================================================== -->
		<!-- Encoding -->
		<!-- =========================================================== -->
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<!-- =========================================================== -->
		<!-- Plugin versions -->
		<!-- =========================================================== -->
		<maven.compiler.plugin.version>3.6.1</maven.compiler.plugin.version>
		<maven.source.plugin.version>3.2.1</maven.source.plugin.version>
		<maven.dependency.plugin.version>3.5.0</maven.dependency.plugin.version>
		<maven.jar.plugin.version>2.2</maven.jar.plugin.version>
		<maven.surefire.plugin.version>2.12</maven.surefire.plugin.version>
		<maven.enforcer.plugin.version>3.0.0-M1</maven.enforcer.plugin.version>
		<build.helper.maven.plugin.version>3.0.0</build.helper.maven.plugin.version>
		<maven.plugin.plugin.version>3.6.0</maven.plugin.plugin.version>
		<nexus.staging.maven.plugin.version>1.6.7</nexus.staging.maven.plugin.version>
		<maven.gpg.plugin.version>3.0.1</maven.gpg.plugin.version>
		<!-- =========================================================== -->
		<!-- Versions -->
		<!-- =========================================================== -->
		<openapi.generator.version>4.3.1</openapi.generator.version>
		<junit.version>4.8.1</junit.version>
		<maven.core.version>3.3.1</maven.core.version>
		<maven.artifact.version>3.2.5</maven.artifact.version>
		<maven.compat.version>3.5.0</maven.compat.version>
		<maven.plugin.api.version>3.3.1</maven.plugin.api.version>
		<maven.plugin.annotations.version>3.4</maven.plugin.annotations.version>
		<plexus.build.api.version>0.0.7</plexus.build.api.version>
		<swagger-ui.version>4.18.2</swagger-ui.version>
	</properties>

	<prerequisites>
		<maven>${maven.core.version}</maven>
	</prerequisites>

	<build>
		<!-- =========================================================== -->
		<!-- Plugins -->
		<!-- =========================================================== -->
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-compiler-plugin</artifactId>
					<version>${maven.compiler.plugin.version}</version>
					<configuration>
						<source>${maven.compiler.source}</source>
						<target>${maven.compiler.target}</target>
					</configuration>
				</plugin>
				<!-- attach test jar -->
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-jar-plugin</artifactId>
					<version>${maven.jar.plugin.version}</version>
					<executions>
						<execution>
							<goals>
								<goal>jar</goal>
								<goal>test-jar</goal>
							</goals>
						</execution>
					</executions>
					<configuration>
					</configuration>
				</plugin>
				<!-- Maven junit test plugin -->
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-surefire-plugin</artifactId>
					<version>${maven.surefire.plugin.version}</version>
					<configuration>
						<systemProperties>
							<property>
								<name>loggerPath</name>
								<value>conf/log4j.properties</value>
							</property>
						</systemProperties>
						<argLine>-Xms512m -Xmx1500m</argLine>
						<parallel>methods</parallel>
						<forkMode>pertest</forkMode>
					</configuration>
				</plugin>
			</plugins>
		</pluginManagement>

		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-enforcer-plugin</artifactId>
				<version>${maven.enforcer.plugin.version}</version>
				<executions>
					<execution>
						<id>enforce-maven</id>
						<goals>
							<goal>enforce</goal>
						</goals>
						<configuration>
							<rules>
								<requireMavenVersion>
									<version>${maven.core.version}</version>
								</requireMavenVersion>
							</rules>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>build-helper-maven-plugin</artifactId>
				<version>${build.helper.maven.plugin.version}</version>
				<executions>
					<execution>
						<id>add_sources</id>
						<phase>generate-sources</phase>
						<goals>
							<goal>add-source</goal>
						</goals>
						<configuration>
							<sources>
								<source>src/main/java</source>
							</sources>
						</configuration>
					</execution>
					<execution>
						<id>add_test_sources</id>
						<phase>generate-test-sources</phase>
						<goals>
							<goal>add-test-source</goal>
						</goals>
						<configuration>
							<sources>
								<source>src/test/java</source>
							</sources>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-plugin-plugin</artifactId>
				<version>${maven.plugin.plugin.version}</version>
			</plugin>

			<!-- Source -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-source-plugin</artifactId>
				<version>${maven.source.plugin.version}</version>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<version>${maven.dependency.plugin.version}</version>
				<executions>
					<execution>
						<id>add-swagger-ui</id>
						<phase>generate-sources</phase>
						<goals>
							<goal>unpack</goal>
						</goals>
						<configuration>
							<artifactItems>
								<artifactItem>
									<groupId>org.webjars</groupId>
									<artifactId>swagger-ui</artifactId>
									<version>${swagger-ui.version}</version>
									<type>jar</type>
									<overWrite>false</overWrite>
									<includes>META-INF/resources/webjars/swagger-ui/${swagger-ui.version}/*.*</includes>
									<fileMappers>
										<org.codehaus.plexus.components.io.filemappers.RegExpFileMapper>
											<pattern>^\QMETA-INF/resources/webjars/swagger-ui/${swagger-ui.version}/\E</pattern>
											<replacement>./</replacement>
										</org.codehaus.plexus.components.io.filemappers.RegExpFileMapper>
									</fileMappers>
									<outputDirectory>${project.build.directory}/classes/swagger-ui</outputDirectory>
								</artifactItem>
							</artifactItems>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
	
	<profiles>
		<profile>
			<id>generate-local-version</id>
			<build>
				<plugins>
					<!-- Source -->
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-source-plugin</artifactId>
					</plugin>
					<!-- JavaDoc -->
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-javadoc-plugin</artifactId>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>generate-version</id>
			<build>
				<plugins>
					<!-- Source -->
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-source-plugin</artifactId>
					</plugin>
					<!-- JavaDoc -->
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-javadoc-plugin</artifactId>
					</plugin>
					<plugin>
						<groupId>org.sonatype.plugins</groupId>
						<artifactId>nexus-staging-maven-plugin</artifactId>
						<version>${nexus.staging.maven.plugin.version}</version>
						<extensions>true</extensions>
						<configuration>
							<serverId>ossrh</serverId>
							<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
							<autoReleaseAfterClose>true</autoReleaseAfterClose>
						</configuration>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-gpg-plugin</artifactId>
    					<version>${maven.gpg.plugin.version}</version>
						<executions>
							<execution>
								<id>sign-artifacts</id>
								<phase>verify</phase>
								<goals>
									<goal>sign</goal>
								</goals>
								<configuration>
									<!-- Prevent gpg from using pinentry programs. Fixes: gpg: signing 
										failed: Inappropriate ioctl for device -->
									<gpgArguments>
										<arg>--pinentry-mode</arg>
										<arg>loopback</arg>
									</gpgArguments>
									<keyname>${gpg.keyname}</keyname>
									<passphraseServerId>${gpg.keyname}</passphraseServerId>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>

	<dependencies>
		<dependency>
			<groupId>org.openapitools</groupId>
			<artifactId>openapi-generator</artifactId>
			<version>${openapi.generator.version}</version>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>${junit.version}</version>
		</dependency>

		<dependency>
			<groupId>org.apache.maven</groupId>
			<artifactId>maven-core</artifactId>
			<version>${maven.core.version}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.maven</groupId>
			<artifactId>maven-artifact</artifactId>
			<version>${maven.artifact.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.maven</groupId>
			<artifactId>maven-compat</artifactId>
			<version>${maven.compat.version}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.maven</groupId>
			<artifactId>maven-plugin-api</artifactId>
			<version>${maven.plugin.api.version}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.maven.plugin-tools</groupId>
			<artifactId>maven-plugin-annotations</artifactId>
			<version>${maven.plugin.annotations.version}</version>
		</dependency>
		<dependency>
			<groupId>org.sonatype.plexus</groupId>
			<artifactId>plexus-build-api</artifactId>
			<version>${plexus.build.api.version}</version>
		</dependency>
	</dependencies>
</project>
