<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/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>io.github.abdi-icap</groupId>
		<artifactId>reporting</artifactId>
		<version>2.2.2</version>
	</parent>
	<artifactId>reporting-omod</artifactId>
	<packaging>jar</packaging>
	<name>Reporting OMOD</name>
	<description>OpenMRS module project for Reporting</description>

	<dependencies>
		<dependency>
			<groupId>io.github.abdi-icap</groupId>
			<artifactId>reporting-api</artifactId>
			<version>${project.version}</version>
			<scope>compile</scope>
		</dependency>
		<dependency>
			<groupId>org.openmrs.module</groupId>
			<artifactId>legacyui-omod</artifactId>
			<version>0.2</version>
			<scope>provided</scope>
		</dependency>
	</dependencies>

	<build>
		<finalName>${project.parent.artifactId}-${project.parent.version}</finalName>
		<resources>
			<resource>
				<directory>src/main/resources</directory>
				<filtering>false</filtering>
				<excludes>
					<exclude>**/*.xml</exclude>
					<exclude>**/*.properties</exclude>
				</excludes>
			</resource>
			<resource>
				<directory>src/main/resources</directory>
				<filtering>true</filtering>
				<includes>
					<include>**/*.xml</include>
					<include>**/*.properties</include>
				</includes>
			</resource>
			<resource>
				<directory>src/main/webapp</directory>
				<filtering>false</filtering>
				<targetPath>web/module</targetPath>
			</resource>
		</resources>

		<plugins>
			<plugin>
				<groupId>org.openmrs.maven.plugins</groupId>
				<artifactId>maven-openmrs-plugin</artifactId>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<executions>
					<execution>
						<id>Expand resources</id>
						<goals>
							<goal>unpack-dependencies</goal>
						</goals>
						<phase>generate-resources</phase>
						<configuration>
							<includeGroupIds>${project.parent.groupId}</includeGroupIds>
							<includeArtifactIds>${project.parent.artifactId}-api</includeArtifactIds>
							<includeScope>compile</includeScope>
							<includes>**\/*.xml,**\/*.properties</includes>
							<outputDirectory>${project.build.directory}/classes</outputDirectory>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

	<profiles>
		<profile>
			<id>deploy-web</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-antrun-plugin</artifactId>
						<executions>
							<execution>
								<phase>package</phase>
								<goals>
									<goal>run</goal>
								</goals>
								<configuration>
									<tasks>
										<copy todir="${deploy.path}/WEB-INF/view/module/${project.parent.artifactId}">
											<fileset dir="src/main/webapp" includes="**/*" />
										</copy>
									</tasks>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>

</project>
