<?xml version="1.0" encoding="UTF-8"?>
<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.opencds.cqf.cql</groupId>
    <artifactId>engine.shared</artifactId>
    <version>2.0.0</version>

    <name>engine.shared</name>
    <description>CQL Engine Project</description>
    <url>https://github.com/DBCG/cql_engine/tree/master</url>

    <packaging>pom</packaging>

    <modules>
        <module>engine</module>
        <module>engine.fhir</module>
        <module>engine.jackson</module>
        <module>engine.jaxb</module>
    </modules>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Bryn Rhodes</name>
        </developer>
        <developer>
            <name>Chris Schuler</name>
        </developer>
        <developer>
            <name>Jonathan Percival</name>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/DBCG/cql_engine.git</connection>
        <developerConnection>scm:git:ssh://github.com:DBCG/cql_engine.git</developerConnection>
        <url>https://github.com/DBCG/cql_engine/tree/master</url>
    </scm>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <jackson.version>2.13.2</jackson.version>
        <jackson-databind.version>2.13.2.1</jackson-databind.version>
        <cqframework.version>2.1.0</cqframework.version>
        <hapi.version>6.0.1</hapi.version>
        <slf4j.version>1.7.29</slf4j.version>
        <surefire.version>3.0.0-M7</surefire.version>
    </properties>

    <repositories>
        <repository>
            <id>oss-sonatype</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>oss-sonatype-public</id>
            <url>https://oss.sonatype.org/content/groups/public/</url>
        </repository>
    </repositories>

    <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>

    <dependencyManagement>
        <dependencies>
            <!-- StringUtils, ExceptionUtils and Pair classes. -->
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-text</artifactId>
                <version>1.9</version>
            </dependency>

            <!-- JAXB related dependencies -->
            <dependency>
                <groupId>org.jvnet.jaxb2_commons</groupId>
                <artifactId>jaxb2-basics-runtime</artifactId>
                <version>0.13.1</version>
            </dependency>
            <dependency>
                <groupId>jakarta.xml.bind</groupId>
                <artifactId>jakarta.xml.bind-api</artifactId>
                <version>2.3.3</version>
            </dependency>

            <dependency>
                <groupId>org.eclipse.persistence</groupId>
                <artifactId>org.eclipse.persistence.moxy</artifactId>
                <version>2.7.7</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>org.glassfish</groupId>
                <artifactId>javax.json</artifactId>
                <version>1.0.4</version>
                <scope>test</scope>
            </dependency>

            <!-- Jackson dependencies -->
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>${jackson-databind.version}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-annotations</artifactId>
                <version>${jackson.version}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-core</artifactId>
                <version>${jackson.version}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.module</groupId>
                <artifactId>jackson-module-jaxb-annotations</artifactId>
                <version>${jackson.version}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.dataformat</groupId>
                <artifactId>jackson-dataformat-xml</artifactId>
                <version>${jackson.version}</version>
            </dependency>

            <!-- UCUM related depedencies-->
            <dependency>
                <groupId>org.fhir</groupId>
                <artifactId>ucum</artifactId>
                <version>1.0.3</version>
                <exclusions>
                    <exclusion>
                        <groupId>xpp3</groupId>
                        <artifactId>xpp3</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>xpp3</groupId>
                        <artifactId>xpp3_xpath</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <!-- HAPI Fhir dependencies -->
            <dependency>
                <groupId>ca.uhn.hapi.fhir</groupId>
                <artifactId>hapi-fhir-client</artifactId>
                <version>${hapi.version}</version>
            </dependency>
            <dependency>
                <groupId>ca.uhn.hapi.fhir</groupId>
                <artifactId>hapi-fhir-structures-dstu2</artifactId>
                <version>${hapi.version}</version>
            </dependency>
            <dependency>
                <groupId>ca.uhn.hapi.fhir</groupId>
                <artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
                <version>${hapi.version}</version>
            </dependency>
            <dependency>
                <groupId>ca.uhn.hapi.fhir</groupId>
                <artifactId>hapi-fhir-structures-dstu3</artifactId>
                <version>${hapi.version}</version>
            </dependency>
            <dependency>
                <groupId>ca.uhn.hapi.fhir</groupId>
                <artifactId>hapi-fhir-structures-r4</artifactId>
                <version>${hapi.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>xpp3</groupId>
                        <artifactId>xpp3</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>xpp3</groupId>
                        <artifactId>xpp3_xpath</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>ca.uhn.hapi.fhir</groupId>
                <artifactId>hapi-fhir-structures-r5</artifactId>
                <version>${hapi.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>xpp3</groupId>
                        <artifactId>xpp3</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>xpp3</groupId>
                        <artifactId>xpp3_xpath</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <!-- These break the engine in certain environments due to the
            fact that they include the javax.xml.namespace package, which creates
            a split package. We may need to filter or exclude them at some point
            in the future.-->
            <dependency>
                <groupId>xpp3</groupId>
                <artifactId>xpp3</artifactId>
                <version>1.1.4c</version>
            </dependency>
            <dependency>
                <groupId>xpp3</groupId>
                <artifactId>xpp3_xpath</artifactId>
                <version>1.1.4c</version>
            </dependency>


            <!-- Testing dependencies -->

            <!-- The scope of info.cqframework dependency must remain as test.
                There is an intentional separation between the CQL translator and the CQL engine -->
            <dependency>
                <groupId>info.cqframework</groupId>
                <artifactId>cql-to-elm</artifactId>
                <version>${cqframework.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>info.cqframework</groupId>
                <artifactId>fhir-r4</artifactId>
                <version>${cqframework.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>info.cqframework</groupId>
                <artifactId>quick</artifactId>
                <version>${cqframework.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>info.cqframework</groupId>
                <artifactId>elm-jackson</artifactId>
                <version>${cqframework.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>info.cqframework</groupId>
                <artifactId>model-jackson</artifactId>
                <version>${cqframework.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>info.cqframework</groupId>
                <artifactId>elm-jaxb</artifactId>
                <version>${cqframework.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>info.cqframework</groupId>
                <artifactId>model-jaxb</artifactId>
                <version>${cqframework.version}</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>org.testng</groupId>
                <artifactId>testng</artifactId>
                <version>7.6.0</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.hamcrest</groupId>
                <artifactId>hamcrest-all</artifactId>
                <version>1.3</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>uk.co.datumedge</groupId>
                <artifactId>hamcrest-json</artifactId>
                <version>0.2</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.hamcrest</groupId>
                        <artifactId>hamcrest-core</artifactId>
                    </exclusion>
                </exclusions>
                <scope>test</scope>
            </dependency>
            <!-- Logging Services -->
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>jcl-over-slf4j</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-simple</artifactId>
                <version>${slf4j.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>com.github.tomakehurst</groupId>
                <artifactId>wiremock-jre8</artifactId>
                <version>2.33.2</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <!-- Used by every project -->
    <dependencies>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>uk.co.datumedge</groupId>
            <artifactId>hamcrest-json</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>3.1.2</version>
                    <dependencies>
                        <dependency>
                            <groupId>com.puppycrawl.tools</groupId>
                            <artifactId>checkstyle</artifactId>
                            <version>10.3</version>
                        </dependency>
                    </dependencies>
                    <executions>
                        <execution>
                            <?m2e ignore?>
                            <id>validate</id>
                            <phase>generate-sources</phase>
                            <configuration>
                                <configLocation>config/checkstyle/checkstyle.xml</configLocation>
                                <encoding>UTF-8</encoding>
                                <consoleOutput>true</consoleOutput>
                                <failOnViolation>true</failOnViolation>
                                <failsOnError>false</failsOnError>
                                <!-- don't include the generated-sources -->
                                <sourceDirectories>
                                    <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
                                    <sourceDirectory>${project.build.testSourceDirectory}</sourceDirectory>
                                </sourceDirectories>
                            </configuration>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>com.github.spotbugs</groupId>
                    <artifactId>spotbugs-maven-plugin</artifactId>
                    <version>4.7.0.0</version>
                    <configuration>
                        <effort>Max</effort>
                        <!-- TODO: Gradually migrate this down to Medium and then Low-->
                        <threshold>High</threshold>
                        <excludeFilterFile>config/spotbugs/exclude.xml</excludeFilterFile>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>3.0.0-M2</version>
                </plugin>
                <plugin>
                    <groupId>org.jvnet.jaxb2.maven2</groupId>
                    <artifactId>maven-jaxb2-plugin</artifactId>
                    <version>0.15.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.10.1</version>
                    <configuration>
                        <release>11</release>
                        <source>11</source>
                        <target>11</target>
                        <failOnError>true</failOnError>
                        <failOnWarning>false</failOnWarning>
                        <compilerArgs>
                            <arg>-Xlint:all</arg>
                            <!-- This fixes a boostrapclass path warning which the "release" property fixes on Java 9+ -->
                            <arg>-Xlint:-options</arg>
                            <arg>-Werror</arg>
                        </compilerArgs>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.2.2</version>
                    <configuration>
                        <archive>
                            <manifest>
                                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                                <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                            </manifest>
                        </archive>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>3.4.0</version>
                    <configuration>
                        <source>11</source>
                    </configuration>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>3.2.1</version>
                    <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>3.0.1</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.6.13</version>
                    <extensions>true</extensions>
                    <configuration>
                        <serverId>ossrh</serverId>
                        <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                        <!-- <autoReleaseAfterClose>true</autoReleaseAfterClose> -->
                        <skipStagingRepositoryClose>true</skipStagingRepositoryClose>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>3.1.0</version>
                    <executions>
                        <execution>
                            <id>enforce-no-snapshots</id>
                            <goals>
                                <goal>enforce</goal>
                            </goals>
                            <configuration>
                                <rules>
                                    <requireReleaseVersion>
                                        <message>No Snapshot Versions Allowed!</message>
                                    </requireReleaseVersion>
                                    <requireReleaseDeps>
                                        <message>No Snapshot Dependencies Allowed!</message>
                                    </requireReleaseDeps>
                                </rules>
                                <fail>true</fail>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${surefire.version}</version>
                    <configuration>
                        <redirectTestOutputToFile>true</redirectTestOutputToFile>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>integration-test</goal>
                                <goal>verify</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${surefire.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>3.3.0</version>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>0.8.8</version>
                    <executions>
                        <execution>
                            <id>jacoco-initialize</id>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>jacoco-report</id>
                            <phase>prepare-package</phase>
                            <goals>
                                <goal>report</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-pmd-plugin</artifactId>
                    <version>3.17.0</version>
                    <dependencies>
                        <dependency>
                            <groupId>org.ow2.asm</groupId>
                            <artifactId>asm</artifactId>
                            <version>9.3</version>
                        </dependency>
                    </dependencies>
                    <configuration>
                        <analysisCache>true</analysisCache>
                        <printFailingErrors>true</printFailingErrors>
                        <!-- TODO: Gradually raise to 5 -->
                        <failurePriority>2</failurePriority>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jxr-plugin</artifactId>
                    <version>3.2.0</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <!-- Results in NullReferenceException in my environment...
            <plugin>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.jvnet.jaxb2.maven2</groupId>
                <artifactId>maven-jaxb2-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.surefire</groupId>
                        <artifactId>surefire-testng</artifactId>
                        <version>${surefire.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jxr-plugin</artifactId>
            </plugin>
        </plugins>
    </reporting>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-enforcer-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>java-11</id>
            <activation>
                <jdk>[11,)</jdk>
            </activation>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-compiler-plugin</artifactId>
                            <configuration>
                                <release>11</release>
                            </configuration>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>
    </profiles>
</project>
