<!-- Copyright 2018 ABSA Group Limited ~ ~ Licensed under the
	Apache License, Version 2.0 (the "License"); ~ you may not use this file 
	except in compliance with the License. ~ You may obtain a copy of the License 
	at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by 
	applicable law or agreed to in writing, software ~ distributed under the 
	License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS 
	OF ANY KIND, either express or implied. ~ See the License for the specific 
	language governing permissions and ~ limitations under the License. -->

<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>za.co.absa</groupId>
	<artifactId>abris_2.11</artifactId>
	<version>2.2.2</version>
	<name>abris</name>
	<description>Provides seamless integration between Avro and Spark Structured APIs.</description>
	<url>https://github.com/AbsaOSS/ABRiS</url>

	<distributionManagement>
		<snapshotRepository>
			<id>ossrh</id>
			<url>https://oss.sonatype.org/content/repositories/snapshots</url>
		</snapshotRepository>
		<repository>
			<id>ossrh</id>
			<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
		</repository>
	</distributionManagement>

	<!-- Confluent repository since their dependencies are not available in Maven Central -->
	<repositories>
		<repository>
			<id>confluent</id>
			<url>http://packages.confluent.io/maven/</url>
		</repository>
	</repositories>

	<properties>
		<maven.compiler.source>1.8</maven.compiler.source>
		<maven.compiler.target>1.8</maven.compiler.target>
		<maven.deploy.plugin>2.8.1</maven.deploy.plugin>

		<mockito.version>1.8.5</mockito.version>
		<scalatest.version>3.0.0</scalatest.version>
		<scalatest.maven.version>1.0</scalatest.maven.version>
		<scala.maven.plugin.version>3.3.2</scala.maven.plugin.version>

		<spark.version>2.3.0</spark.version>
		<kafka.spark.version>0-10</kafka.spark.version>

		<scala.version>2.11.8</scala.version>
		<scala.compat.version>2.11</scala.compat.version>
		<specs.version>2.4.16</specs.version>
		<scalatest.version>3.0.1</scalatest.version>

		<databricks.spark.avro>4.0.0</databricks.spark.avro>

		<avro.version>1.8.2</avro.version>

		<jackson.databind.version>2.6.1</jackson.databind.version>

		<confluent.version>5.1.0</confluent.version>

		<gpg.plugin.version>1.6</gpg.plugin.version>
	</properties>

    <scm>
        <connection>scm:git:git://github.com/AbsaOSS/ABRiS.git</connection>
        <developerConnection>scm:git:ssh://github.com:AbsaOSS/ABRiS.git</developerConnection>
        <url>https://github.com/AbsaOSS/ABRiS/tree/master</url>
      <tag>abris_2.11-2.2.0</tag>
  </scm>

	<licenses>
		<license>
			<name>Apache License, Version 2.0</name>
			<url>https://www.apache.org/licenses/LICENSE-2.0</url>
			<distribution>repo</distribution>
		</license>
	</licenses>

	<organization>
		<name>ABSA Group Limited</name>
		<url>https://www.absa.africa</url>
	</organization>

	<developers>
		<developer>
			<id>felipemmelo</id>
			<name>Felipe Melo</name>
			<timezone>Europe/Prague</timezone>
			<url>https://github.com/felipemmelo</url>
		</developer>
	</developers>

	<dependencies>

		<!-- Provides Avro schema to Spark StructType conversion -->
		<dependency>
			<groupId>com.databricks</groupId>
			<artifactId>spark-avro_2.11</artifactId>
		</dependency>

		<!-- Tests -->
		<dependency>
			<groupId>org.specs2</groupId>
			<artifactId>specs2-core_${scala.compat.version}</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.scalatest</groupId>
			<artifactId>scalatest_${scala.compat.version}</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.mockito</groupId>
			<artifactId>mockito-core</artifactId>
			<scope>test</scope>
		</dependency>

		<!-- Avro -->
		<dependency>
			<groupId>org.apache.avro</groupId>
			<artifactId>avro</artifactId>
		</dependency>

		<!-- Spark -->
		<dependency>
			<groupId>org.apache.spark</groupId>
			<artifactId>spark-sql_${scala.compat.version}</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.spark</groupId>
			<artifactId>spark-core_${scala.compat.version}</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.spark</groupId>
			<artifactId>spark-streaming_${scala.compat.version}</artifactId>
		</dependency>

		<!-- Spark Kafka -->
		<dependency>
			<groupId>org.apache.spark</groupId>
			<artifactId>spark-sql-kafka-${kafka.spark.version}_${scala.compat.version}</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.spark</groupId>
			<artifactId>spark-streaming-kafka-${kafka.spark.version}_${scala.compat.version}</artifactId>
		</dependency>

		<!-- Jackson -->
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-databind</artifactId>
		</dependency>

		<!-- Remote artifact deployment -->
		<dependency>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-deploy-plugin</artifactId>
		</dependency>

		<!-- Confluent's Kafka and Schema Registry -->
		<dependency>
			<groupId>io.confluent</groupId>
			<artifactId>kafka-avro-serializer</artifactId>
		</dependency>
		<dependency>
			<groupId>io.confluent</groupId>
			<artifactId>kafka-schema-registry-client</artifactId>
		</dependency>
		<dependency>
			<groupId>io.confluent</groupId>
			<artifactId>common-config</artifactId>
		</dependency>
		<dependency>
			<groupId>io.confluent</groupId>
			<artifactId>common-utils</artifactId>
		</dependency>

	</dependencies>

	<dependencyManagement>
		<dependencies>
			<!-- Provides Avro schema to Spark StructType conversion -->
			<dependency>
				<groupId>com.databricks</groupId>
				<artifactId>spark-avro_${scala.compat.version}</artifactId>
				<version>${databricks.spark.avro}</version>
			</dependency>

			<!-- Test -->
			<dependency>
				<groupId>org.scalatest</groupId>
				<artifactId>scalatest_${scala.compat.version}</artifactId>
				<version>${scalatest.version}</version>
			</dependency>
			<dependency>
				<groupId>org.specs2</groupId>
				<artifactId>specs2-core_${scala.compat.version}</artifactId>
				<version>${specs.version}</version>
			</dependency>
			<dependency>
				<groupId>org.mockito</groupId>
				<artifactId>mockito-core</artifactId>
				<version>${mockito.version}</version>
			</dependency>

			<!-- Avro -->
			<dependency>
				<groupId>org.apache.avro</groupId>
				<artifactId>avro</artifactId>
				<version>${avro.version}</version>
			</dependency>

			<!-- Spark -->
			<dependency>
				<groupId>org.apache.spark</groupId>
				<artifactId>spark-sql_${scala.compat.version}</artifactId>
				<version>${spark.version}</version>
			</dependency>
			<dependency>
				<groupId>org.apache.spark</groupId>
				<artifactId>spark-sql-kafka-${kafka.spark.version}_${scala.compat.version}</artifactId>
				<version>${spark.version}</version>
			</dependency>
			<dependency>
				<groupId>org.apache.spark</groupId>
				<artifactId>spark-streaming-kafka-${kafka.spark.version}_${scala.compat.version}</artifactId>
				<version>${spark.version}</version>
			</dependency>
			<dependency>
				<groupId>org.apache.spark</groupId>
				<artifactId>spark-core_${scala.compat.version}</artifactId>
				<version>${spark.version}</version>
			</dependency>
			<dependency>
				<groupId>org.apache.spark</groupId>
				<artifactId>spark-streaming_${scala.compat.version}</artifactId>
				<version>${spark.version}</version>
			</dependency>

			<!-- Jackson -->
			<dependency>
				<groupId>com.fasterxml.jackson.core</groupId>
				<artifactId>jackson-databind</artifactId>
				<version>${jackson.databind.version}</version>
			</dependency>

			<!-- Remote artifact deployment -->
			<dependency>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-deploy-plugin</artifactId>
				<version>${maven.deploy.plugin}</version>
			</dependency>

			<!-- Confluent's Kafka and Schema Registry -->
			<dependency>
				<groupId>io.confluent</groupId>
				<artifactId>kafka-avro-serializer</artifactId>
				<version>${confluent.version}</version>
			</dependency>
			<dependency>
				<groupId>io.confluent</groupId>
				<artifactId>kafka-schema-registry-client</artifactId>
				<version>${confluent.version}</version>
			</dependency>
			<dependency>
				<groupId>io.confluent</groupId>
				<artifactId>common-config</artifactId>
				<version>${confluent.version}</version>
			</dependency>
			<dependency>
				<groupId>io.confluent</groupId>
				<artifactId>common-utils</artifactId>
				<version>${confluent.version}</version>
			</dependency>

		</dependencies>
	</dependencyManagement>

	<build>
		<sourceDirectory>src/main/scala</sourceDirectory>
		<testSourceDirectory>src/test/scala</testSourceDirectory>

		<resources>
			<resource>
				<directory>src/main/resources</directory>
				<filtering>true</filtering>
			</resource>
		</resources>

		<plugins>
			<plugin>
				<artifactId>maven-deploy-plugin</artifactId>
				<version>2.8.1</version>
				<executions>
					<execution>
						<id>default-deploy</id>
						<phase>deploy</phase>
						<goals>
							<goal>deploy</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<!-- the Maven Scala plugin will compile Scala source files -->
			<plugin>
				<groupId>net.alchim31.maven</groupId>
				<artifactId>scala-maven-plugin</artifactId>
				<version>${scala.maven.plugin.version}</version>
				<configuration>
					<scalaVersion>${scala.version}</scalaVersion>
				</configuration>
				<executions>
					<execution>
						<id>scala-compile</id>
						<phase>process-resources</phase>
						<goals>
							<goal>add-source</goal>
							<goal>compile</goal>
						</goals>
					</execution>
					<execution>
						<id>scala-test-compile</id>
						<phase>process-test-resources</phase>
						<goals>
							<goal>testCompile</goal>
						</goals>
					</execution>
					<execution>
						<id>attach-javadocs</id>
						<goals>
							<goal>doc-jar</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<!-- disable surefire -->
			<plugin>
				<artifactId>maven-surefire-plugin</artifactId>
				<configuration>
					<skipTests>true</skipTests>
				</configuration>
			</plugin>

			<!-- enable scalatest -->
			<plugin>
				<groupId>org.scalatest</groupId>
				<artifactId>scalatest-maven-plugin</artifactId>
				<configuration>
					<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
					<junitxml>.</junitxml>
					<filereports>TestSuite.txt</filereports>
				</configuration>
				<executions>
					<execution>
						<id>test</id>
						<goals>
							<goal>test</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

		</plugins>

		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.scalatest</groupId>
					<artifactId>scalatest-maven-plugin</artifactId>
					<version>${scalatest.maven.version}</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-gpg-plugin</artifactId>
					<version>${gpg.plugin.version}</version>
				</plugin>
			</plugins>
		</pluginManagement>
	</build>

	<profiles>
		<profile>
			<id>public</id>
			<build>
				<plugins>
					<!-- generates sources.jar -->
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-source-plugin</artifactId>
						<executions>
							<execution>
								<id>attach-sources</id>
								<goals>
									<goal>jar</goal>
								</goals>
							</execution>
						</executions>
					</plugin>

					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-gpg-plugin</artifactId>
						<version>${gpg.plugin.version}</version>
						<executions>
							<execution>
								<id>sign-artifacts</id>
								<phase>verify</phase>
								<goals>
									<goal>sign</goal>
								</goals>
							</execution>
						</executions>
					</plugin>

					<plugin>
						<groupId>org.sonatype.plugins</groupId>
						<artifactId>nexus-staging-maven-plugin</artifactId>
						<extensions>true</extensions>
						<configuration>
							<serverId>ossrh</serverId>
							<nexusUrl>https://oss.sonatype.org/</nexusUrl>
							<autoReleaseAfterClose>false</autoReleaseAfterClose>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>

</project>
