<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>org.smartregister</groupId>

	<artifactId>opensrp-server-core</artifactId>
	<packaging>jar</packaging>

	<version>1.2.2.1</version>

	<name>opensrp-server-core</name>
	<description>OpenSRP Server Core module</description>
	<url>http://github.com/OpenSRP/opensrp-server-core</url>

	<properties>
		<main.basedir>${project.basedir}</main.basedir>
		<motech.version>0.11</motech.version>
		<spring.version>3.1.0.RELEASE</spring.version>
		<mysql.connector.version>5.1.36</mysql.connector.version>
		<opensrp.updatePolicy>always</opensrp.updatePolicy>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<nexus-staging-maven-plugin.version>1.5.1</nexus-staging-maven-plugin.version>

		<opensrp.common.version>1.0.1-SNAPSHOT</opensrp.common.version>
		<opensrp.api.version>1.0.1</opensrp.api.version>
		<opensrp.form.version>1.0.1</opensrp.form.version>
		<opensrp.interface.version>1.0.1</opensrp.interface.version>

	</properties>

	<distributionManagement>
		<snapshotRepository>
			<id>nexus-snapshots</id>
			<name>Nexus Snapshots Repository</name>
			<url>https://oss.sonatype.org/content/repositories/snapshots</url>
			<uniqueVersion>false</uniqueVersion>
		</snapshotRepository>
		<repository>
			<id>nexus-releases</id>
			<url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
		</repository>
	</distributionManagement>

	<scm>
		<connection>scm:git:git@github.com:OpenSRP/opensrp-server-core.git</connection>
		<developerConnection>scm:git:git@github.com:OpenSRP/opensrp-server-core.git</developerConnection>
		<url>https://github.com/OpenSRP/opensrp-server-core</url>
	</scm>

	<licenses>
		<license>
			<name>Apache License, Version 2.0</name>
			<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
			<distribution>repo</distribution>
			<comments>Open Smart Register Platform (OpenSRP) is Licensed under the Apache License, Version 2.0</comments>
		</license>
	</licenses>

	<developers>
		<developer>
			<id>opensrp_developer</id>
			<name>OpenSRP Developer</name>
			<email>info@smartregister.org</email>
			<url>https://groups.google.com/forum/#!forum/opensrp-dev</url>
			<organization>OpenSRP</organization>
			<organizationUrl>http://smartregister.org</organizationUrl>
			<roles>
				<role>developer</role>
			</roles>
			<timezone>Africa/Nairobi</timezone>
		</developer>
	</developers>

	<repositories>
		<repository>
			<id>snapshots-repo</id>
			<url>https://oss.sonatype.org/content/repositories/snapshots</url>
			<releases>
				<enabled>false</enabled>
			</releases>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
		</repository>
		<repository>
			<id>motech.opensrp</id>
			<name>Motech Snapshots Repository</name>
			<url>http://nexus.motechproject.org/content/repositories/opensrp-server</url>
			<snapshots>
				<enabled>true</enabled>
				<updatePolicy>${opensrp.updatePolicy}</updatePolicy>
			</snapshots>
		</repository>
		<repository>
			<id>motech.nexus</id>
			<name>Motech Snapshots Repository</name>
			<url>http://nexus.motechproject.org/content/repositories/snapshots</url>
			<snapshots>
				<enabled>true</enabled>
				<updatePolicy>${opensrp.updatePolicy}</updatePolicy>
			</snapshots>
		</repository>
		<repository>
			<id>motech.nexus.release</id>
			<name>Motech Snapshots Repository</name>
			<url>http://nexus.motechproject.org/content/repositories/releases</url>
		</repository>
	</repositories>


	<dependencies>
		<dependency>
			<artifactId>motech-platform-server-api</artifactId>
			<groupId>org.motechproject</groupId>
			<version>${motech.version}</version>
		</dependency>
		<dependency>
			<groupId>com.github.ldriscoll</groupId>
			<artifactId>ektorplucene</artifactId>
			<version>0.2.0</version>
		</dependency>

		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-databind</artifactId>
			<version>2.2.2</version>
		</dependency>

		<dependency>
			<artifactId>motech-sms-api</artifactId>
			<groupId>org.motechproject</groupId>
			<version>${motech.version}</version>
		</dependency>
		<dependency>
			<artifactId>motech-sms-http</artifactId>
			<groupId>org.motechproject</groupId>
			<version>${motech.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
			<version>${spring.version}</version>
			<exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-test</artifactId>
			<version>${spring.version}</version>
			<scope>test</scope>
			<exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-aop</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-aspects</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-jdbc</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.smartregister</groupId>
			<artifactId>opensrp-server-api</artifactId>
			<version>${opensrp.api.version}</version>
		</dependency>
		<dependency>
			<groupId>org.smartregister</groupId>
			<artifactId>opensrp-server-common</artifactId>
			<version>${opensrp.common.version}</version>
		</dependency>
		<dependency>
			<groupId>org.smartregister</groupId>
			<artifactId>opensrp-server-form</artifactId>
			<version>${opensrp.form.version}</version>
		</dependency>
		<dependency>
			<groupId>org.smartregister</groupId>
			<artifactId>opensrp-server-interface</artifactId>
			<version>${opensrp.interface.version}</version>
		</dependency>
		<dependency>
			<groupId>org.motechproject</groupId>
			<artifactId>motech-scheduletracking-api</artifactId>
			<version>${motech.version}</version>
		</dependency>
		<dependency>
			<groupId>commons-lang</groupId>
			<artifactId>commons-lang</artifactId>
			<version>2.5</version>
		</dependency>
		<dependency>
			<groupId>org.quartz-scheduler</groupId>
			<artifactId>quartz</artifactId>
			<version>2.1.5</version>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.12</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.mockito</groupId>
			<artifactId>mockito-all</artifactId>
			<version>1.10.19</version>
		</dependency>
		<dependency>
			<groupId>org.powermock</groupId>
			<artifactId>powermock-module-junit4</artifactId>
			<version>1.7.0</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.powermock</groupId>
			<artifactId>powermock-api-mockito</artifactId>
			<version>1.7.0</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.motechproject</groupId>
			<artifactId>motech-testing-utils</artifactId>
			<version>${motech.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.poi</groupId>
			<artifactId>poi</artifactId>
			<version>3.13</version>
		</dependency>
		<dependency>
			<groupId>ch.maxant</groupId>
			<artifactId>rules</artifactId>
			<version>2.1.0</version>
		</dependency>
		<dependency>
			<groupId>org.apache.httpcomponents</groupId>
			<artifactId>httpclient</artifactId>
			<version>4.5.2</version>
		</dependency>
		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-dbcp2</artifactId>
			<version>2.1</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.springframework.data/spring-data-jpa -->
		<dependency>
			<groupId>org.springframework.data</groupId>
			<artifactId>spring-data-jpa</artifactId>
			<version>1.1.0.RELEASE</version>
		</dependency>
		<dependency>
			<groupId>nl.jqno.equalsverifier</groupId>
			<artifactId>equalsverifier</artifactId>
			<version>2.3</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>com.openpojo</groupId>
			<artifactId>openpojo</artifactId>
			<version>0.8.6</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-annotations -->
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-entitymanager</artifactId>
			<version>4.2.8.Final</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.springframework/spring-orm -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-orm</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis</artifactId>
			<version>3.4.6</version>
		</dependency>
		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis-spring</artifactId>
			<version>1.3.2</version>
		</dependency>
		<dependency>
			<groupId>org.jacoco</groupId>
			<artifactId>org.jacoco.agent</artifactId>
			<version>0.7.9</version>
			<scope>test</scope>
			<classifier>runtime</classifier>
		</dependency>
		<!-- https://mvnrepository.com/artifact/org.apache.tomcat/tomcat-jdbc -->
		<dependency>
			<groupId>org.apache.tomcat</groupId>
			<artifactId>tomcat-jdbc</artifactId>
			<version>7.0.85</version>
			<!-- <scope>provided</scope> -->
		</dependency>
		<!-- https://mvnrepository.com/artifact/postgresql/postgresql -->
		<dependency>
			<groupId>org.postgresql</groupId>
			<artifactId>postgresql</artifactId>
			<version>42.2.1.jre7</version>
		</dependency>
	</dependencies>

	<build>
		<resources>
			<resource>
				<directory>configs/assets/config</directory>
			</resource>
			<resource>
				<directory>configs/assets/schedules</directory>
				<targetPath>schedules</targetPath>
			</resource>
			<resource>
				<directory>configs/build</directory>
				<filtering>true</filtering>
				<includes>
					<include>maven.properties</include>
				</includes>
			</resource>
			<resource>
				<directory>configs/modules/core/ziggy</directory>
				<targetPath>ziggy</targetPath>
			</resource>
			<resource>
				<directory>configs/modules/core/queries</directory>
				<targetPath>queries</targetPath>
			</resource>
			<resource>
				<directory>src/main/java/org/opensrp/repository/postgres/mapper/xml</directory>
				<targetPath>org/opensrp/repository/postgres/mapper/xml</targetPath>
			</resource>
			<resource>
				<directory>src/main/java/org/opensrp/repository/postgres/mapper/custom/xml</directory>
				<targetPath>org/opensrp/repository/postgres/mapper/custom/xml</targetPath>
			</resource>
		</resources>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>2.5.1</version>
				<configuration>
					<source>1.7</source>
					<target>1.7</target>
					<encoding>UTF-8</encoding>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-resources-plugin</artifactId>
				<version>2.5</version>
				<configuration>
					<encoding>UTF-8</encoding>
					<outputDirectory />
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<version>2.3</version>
				<configuration>
					<excludes>
						<exclude>**/*.properties</exclude>
					</excludes>
				</configuration>
			</plugin>
			<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-javadoc-plugin</artifactId>
				<executions>
					<execution>
						<id>attach-javadocs</id>
						<goals>
							<goal>jar</goal>
						</goals>
						<configuration>
							<doclint>none</doclint>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>properties-maven-plugin</artifactId>
				<version>1.0.0</version>
				<executions>
					<execution>
						<phase>initialize</phase>
						<goals>
							<goal>read-project-properties</goal>
						</goals>
						<configuration>
							<files>
								<file>${basedir}/configs/build/maven.properties</file>
								<file>${basedir}/configs/assets/config/opensrp.properties</file>
							</files>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<version>2.20</version>
				<configuration>
					<printSummary>true</printSummary>
					<excludes>
						<exclude>**/it/**</exclude>
					</excludes>

				</configuration>
			</plugin>
			<plugin>
				<groupId>org.sonatype.plugins</groupId>
				<artifactId>nexus-staging-maven-plugin</artifactId>
				<version>${nexus-staging-maven-plugin.version}</version>
				<executions>
					<execution>
						<id>default-deploy</id>
						<phase>deploy</phase>
						<goals>
							<goal>deploy</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<serverId>nexus-snapshots</serverId>
					<nexusUrl>https://oss.sonatype.org/</nexusUrl>
					<skipStaging>true</skipStaging>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.jacoco</groupId>
				<artifactId>jacoco-maven-plugin</artifactId>
				<version>0.7.9</version>
				<configuration>
					<destFile>${basedir}/target/coverage-reports/jacoco-unit.exec</destFile>
					<dataFile>${basedir}/target/coverage-reports/jacoco-unit.exec</dataFile>
				</configuration>
				<executions>
					<execution>
						<id>jacoco-initialize</id>
						<goals>
							<goal>prepare-agent</goal>
						</goals>
					</execution>
					<execution>
						<id>jacoco-site</id>
						<phase>test</phase>
						<goals>
							<goal>report</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.eluder.coveralls</groupId>
				<artifactId>coveralls-maven-plugin</artifactId>
				<version>4.0.0</version>
			</plugin>
		</plugins>
	</build>

	<profiles>
		<profile>
			<id>skip-integration-tests</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-failsafe-plugin</artifactId>
						<version>2.9</version>
						<executions>
							<execution>
								<goals>
									<goal>integration-test</goal>
									<goal>verify</goal>
								</goals>
								<configuration>
									<argLine>-XX:MaxPermSize=1024M</argLine>
									<excludes>
										<exclude>**/it/**</exclude>
									</excludes>
									<redirectTestOutputToFile>true</redirectTestOutputToFile>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>integration-tests</id>
			<activation>
				<activeByDefault>true</activeByDefault>
			</activation>

			<build>
				<!-- <pluginManagement> -->
				<plugins>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>sql-maven-plugin</artifactId>
						<version>1.5</version>
						<dependencies>
							<!-- <dependency> <groupId>postgresql</groupId> <artifactId>postgresql</artifactId> 
								<version>9.1-901.jdbc4</version> </dependency> -->
							<dependency>
								<groupId>mysql</groupId>
								<artifactId>mysql-connector-java</artifactId>
								<version>${mysql.connector.version}</version>
							</dependency>
						</dependencies>

						<configuration>
							<driver>${jdbc.driverClassName}</driver>
							<url>${jdbc.url-wo-db}</url>
							<username>${jdbc.username}</username>
							<password>${jdbc.password}</password>
							<skip>${maven.test.skip}</skip>
						</configuration>

						<executions>
							<!-- Database init scripts for DBMS specific configuration -->
							<execution>
								<id>drop-create-relational-db</id>
								<phase>pre-integration-test</phase>
								<goals>
									<goal>execute</goal>
								</goals>
								<configuration>
									<url>${jdbc.url-wo-db}</url>
									<username>${jdbc.username}</username>
									<password>${jdbc.password}</password>
									<autocommit>true</autocommit>
									<sqlCommand>
										drop database if exists ${db.quartz};
										create
										database ${db.quartz};
									</sqlCommand>
									<onError>abort</onError>
								</configuration>
							</execution>
							<!-- END: Database init scripts for DBMS specific configuration -->
							<execution>
								<id>create-quartz-tables</id>
								<phase>pre-integration-test</phase>
								<goals>
									<goal>execute</goal>
								</goals>
								<configuration>
									<url>${jdbc.url-wo-db}/${db.quartz}</url>
									<username>${jdbc.username}</username>
									<password>${jdbc.password}</password>
									<autocommit>true</autocommit>
									<srcFiles>
										<srcFile>configs/build/sql/tables_quartz_${jdbc.backend}.sql</srcFile>
									</srcFiles>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-failsafe-plugin</artifactId>
						<version>2.9</version>
						<executions>
							<execution>
								<goals>
									<goal>integration-test</goal>
									<goal>verify</goal>
								</goals>
								<configuration>
									<argLine>-XX:MaxPermSize=1024M</argLine>
									<includes>
										<include>**/it/**</include>
									</includes>
									<redirectTestOutputToFile>true</redirectTestOutputToFile>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
				<!-- </pluginManagement> -->
			</build>
		</profile>
		<profile>
			<id>couchdb</id>
			<activation>
				<property>
					<name>opensrp.database.type</name>
					<value>couchdb</value>
				</property>
			</activation>
			<properties>
				<opensrp.database.profile>couchDb</opensrp.database.profile>
			</properties>
		</profile>
		<profile>
			<id>postgres</id>
			<activation>
				<activeByDefault>true</activeByDefault>
				<property>
					<name>opensrp.database.type</name>
					<value>postgres</value>
				</property>
			</activation>
			<properties>
				<opensrp.database.profile>postgres</opensrp.database.profile>
			</properties>
		</profile>
		<profile>
			<id>release</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-gpg-plugin</artifactId>
						<version>1.5</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>
						<version>1.5.1</version>
						<executions>
							<execution>
								<id>default-deploy</id>
								<phase>deploy</phase>
								<goals>
									<goal>deploy</goal>
								</goals>
							</execution>
						</executions>
						<configuration>
							<serverId>nexus-releases</serverId>
							<nexusUrl>https://oss.sonatype.org/</nexusUrl>
							<skipStaging>false</skipStaging>
							<autoReleaseAfterClose>true</autoReleaseAfterClose>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>
</project>
