<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>ethiohri-mamba</artifactId>
        <version>2.1.2</version>
    </parent>

    <artifactId>ethiohri-mamba-omod</artifactId>
    <packaging>jar</packaging>
    <name>MambaETL Reference module - OMOD</name>
    <description>OpenMRS MambaETL Reference module - OMOD</description>
    <dependencies>
        <dependency>
            <groupId>org.openmrs.api</groupId>
            <artifactId>openmrs-api</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
        </dependency>
        <dependency>
            <groupId>io.github.abdi-icap</groupId>
            <artifactId>ethiohri-mamba-api</artifactId>
            <version>${project.parent.version}</version>
        </dependency>
        <dependency>
            <groupId>org.openmrs.web</groupId>
            <artifactId>openmrs-web</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.openmrs.web</groupId>
            <artifactId>openmrs-web</artifactId>
            <scope>provided</scope>
            <classifier>tests</classifier>
        </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>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>3.4.1</version>
                <executions>
                    <!-- This is our custom rule to verify the SQL script exists -->
                    <execution>
                        <id>enforce-sql-script-exists</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <phase>verify</phase>
                        <configuration>
                            <rules>
                                <requireFilesExist>
                                    <files>
                                        <file>${project.build.directory}/mamba-etl/_core/database/mysql/build/jdbc_create_stored_procedures.sql</file>
                                    </files>
                                    <message>
                                        [ERROR] The build script 'jdbc_create_stored_procedures.sql' was not generated. This indicates a failure in the mamba-etl script compiler.
                                    </message>
                                </requireFilesExist>
                            </rules>
                            <fail>true</fail>
                        </configuration>
                    </execution>
                    <!-- This disables the inherited rule from the parent POM -->
                    <execution>
                        <id>enforce-no-snapshots</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <phase>none</phase>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
            </plugin>

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

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>

            <!--
            <plugin>
                <groupId>org.openmrs.maven.plugins</groupId>
                <artifactId>openmrs-sdk-maven-plugin</artifactId>
            </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>
