<?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>1.5.1</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>
    </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>
    </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>http://github.com/DBCG/cql_engine.git/tree/master</url>
    </scm>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <jackson.version>2.12.1</jackson.version>
        <cqframework.version>1.5.1</cqframework.version>
        <hapi.version>5.2.0</hapi.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>

            <!-- JAXB related dependencies -->
            <dependency>
                <groupId>org.jvnet.jaxb2_commons</groupId>
                <artifactId>jaxb2-basics</artifactId>
                <version>0.12.0</version>
            </dependency>

            <dependency>
                <groupId>org.eclipse.persistence</groupId>
                <artifactId>org.eclipse.persistence.moxy</artifactId>
                <version>2.7.7</version>
            </dependency>

            <dependency>
                <groupId>com.google.code.findbugs</groupId>
                <artifactId>jsr305</artifactId>
                <version>3.0.2</version>
            </dependency>


            <!-- Jackson dependencies -->
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>${jackson.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>

            <!-- 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 -->
            <dependency>
                <groupId>info.cqframework</groupId>
                <artifactId>cql-to-elm</artifactId>
                <version>${cqframework.version}</version>
                <!-- The scope of this dependency must remain as test.
            There is an intentional separation between the CQL translator and the CQL engine -->
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.testng</groupId>
                <artifactId>testng</artifactId>
                <version>6.8.8</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>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-simple</artifactId>
                <version>1.7.29</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <!-- Used by every project -->
    <dependencies>
        <dependency>
            <groupId>info.cqframework</groupId>
            <artifactId>cql-to-elm</artifactId>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
        </dependency>
        <dependency>
            <groupId>uk.co.datumedge</groupId>
            <artifactId>hamcrest-json</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>3.0.0-M1</version>
                </plugin>
                <plugin>
                    <groupId>org.jvnet.jaxb2.maven2</groupId>
                    <artifactId>maven-jaxb2-plugin</artifactId>
                    <!-- Update to 0.14.1 once released to remove illegal reflective access warnings-->
                    <version>0.14.0</version>
                    <!-- This replaces the bad version of the jaxb-runtime with the non-reflective access one. -->
                    <dependencies>
                        <dependency>
                            <groupId>org.glassfish.jaxb</groupId>
                            <artifactId>jaxb-runtime</artifactId>
                            <version>2.4.0-b180830.0438</version>
                        </dependency>
                        <dependency>
                            <groupId>org.jvnet.jaxb2.maven2</groupId>
                            <artifactId>maven-jaxb23-plugin</artifactId>
                            <version>0.14.0</version>
                            <exclusions>
                                <exclusion>
                                    <groupId>org.glassfish.jaxb</groupId>
                                    <artifactId>jaxb-runtime</artifactId>
                                </exclusion>
                            </exclusions>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.1</version>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                        <release>8</release>
                        <configuration>
                            <failOnError>true</failOnError>
                            <failOnWarning>true</failOnWarning>
                        </configuration>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.1.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.2.0</version>
                    <configuration>
                        <source>8</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.1.0</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>1.6</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.7</version>
                    <extensions>true</extensions>
                    <configuration>
                        <serverId>ossrh</serverId>
                        <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                        <autoReleaseAfterClose>true</autoReleaseAfterClose>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>3.0.0-M2</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>2.19.1</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>2.21.0</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>3.0.0</version>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>0.8.6</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>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
            </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.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <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>
    </profiles>
</project>

