<!--
 Copyright (C) 2019 Vitasystems GmbH and Hannover Medical School.

 This file is part of Project EHRbase

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->
<project>
    <modelVersion>4.0.0</modelVersion>
    <packaging>pom</packaging>
    <groupId>org.ehrbase.openehr</groupId>
    <artifactId>server</artifactId>
    <version>0.12.0</version>

    <name>${project.groupId}:${project.artifactId}</name>
    <description>EHRbase is a Free, Libre, Open Source openEHR Clinical Data Repository</description>
    <url>https://ehrbase.org</url>

    <licenses>
        <license>
            <name>The Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>

    <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>

    <developers>
        <developer>
            <name>Stefan Spiska</name>
            <email>stefan.spiska@vitasystems.de</email>
            <organization>vitasystems GmbH</organization>
            <organizationUrl>https://www.vitagroup.ag/</organizationUrl>
        </developer>
        <developer>
            <name>Axel Siebert</name>
            <email>axel.siebert@vitasystems.de</email>
            <organization>vitasystems GmbH</organization>
            <organizationUrl>https://www.vitagroup.ag/</organizationUrl>
        </developer>
        <developer>
            <name>Wladislaw Wagner</name>
            <email>wladislaw.wagner@vitasystems.de</email>
            <organization>vitasystems GmbH</organization>
            <organizationUrl>https://www.vitagroup.ag/</organizationUrl>
        </developer>
        <developer>
            <name>Luis Marco-Ruiz</name>
            <email>luis.marco-ruiz@plri.de</email>
            <organization>Hannover Medical School</organization>
            <organizationUrl>https://plri.de/</organizationUrl>
        </developer>
        <developer>
            <name>Jake Smolka</name>
            <email>jake.smolka@plri.de</email>
            <organization>Hannover Medical School</organization>
            <organizationUrl>https://plri.de/</organizationUrl>
        </developer>
        <developer>
            <name>Pablo Pazos</name>
            <email>pablo.pazos@cabolabs.com</email>
            <organization>Hannover Medical School</organization>
            <organizationUrl>https://plri.de/</organizationUrl>
        </developer>
        <developer>
            <name>Christian Chevalley</name>
            <email>christian@adoc.co.th</email>
            <organization>Hannover Medical School</organization>
            <organizationUrl>https://plri.de/</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/ehrbase/ehrbase.git</connection>
        <developerConnection>scm:git:ssh://github.com:ehrbase/ehrbase.git</developerConnection>
        <url>https://github.com/ehrbase/ehrbase</url>
    </scm>

    <repositories>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
    </repositories>

    <properties>
        <maven.compiler.release>11</maven.compiler.release>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <commons.io.version>2.6</commons.io.version>
        <commons.lang3.version>3.8</commons.lang3.version>
        <commons-text.version>1.4</commons-text.version>
        <junit.toolbox.version>2.4</junit.toolbox.version>
        <assertj.core>3.11.1</assertj.core>
        <json.path.version>2.4.0</json.path.version>
        <log4j.version>2.7</log4j.version>
        <jooq.version>3.12.3</jooq.version>
        <jackson.version>2.10.2</jackson.version>
        <keycloak.version>4.0.0.Final</keycloak.version>
        <springfox.version>2.9.2</springfox.version>
        <springfox-snapshot.version>3.0.0-SNAPSHOT</springfox-snapshot.version>
        <spring-security.version>5.2.1.RELEASE</spring-security.version>
        <swagger.version>1.5.23</swagger.version>
        <swagger-snapshot.version>2.0.0-rc2</swagger-snapshot.version>
        <postgressql.version>42.2.5</postgressql.version>
        <flyway.version>6.2.0</flyway.version>
        <database.name>ehrbase</database.name>
        <database.user>ehrbase</database.user>
        <database.pass>ehrbase</database.pass>
        <database.port>5432</database.port>
        <database.host>localhost</database.host>
    </properties>

    <!-- Spring Boot starter parent is taking over most parts of the dependency management -->
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.4.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <modules>
        <module>service</module>
        <module>rest-ehr-scape</module>
        <module>rest-openehr</module>
        <module>application</module>
        <module>base</module>
        <module>api</module>
        <module>jooq-pq</module>
        <module>serialisation</module>
        <module>test-data</module>
        <module>opt</module>
        <module>validation</module>
        <module>terminology</module>
    </modules>


    <dependencyManagement>
        <dependencies>
            <!-- modules -->
            <dependency>
                <groupId>org.ehrbase.openehr</groupId>
                <artifactId>base</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.ehrbase.openehr</groupId>
                <artifactId>service</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.ehrbase.openehr</groupId>
                <artifactId>rest-ehr-scape</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.ehrbase.openehr</groupId>
                <artifactId>rest-openehr</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.ehrbase.openehr</groupId>
                <artifactId>application</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.ehrbase.openehr</groupId>
                <artifactId>api</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.ehrbase.openehr</groupId>
                <artifactId>jooq-pg</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.ehrbase.openehr</groupId>
                <artifactId>serialisation</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.ehrbase.openehr</groupId>
                <artifactId>validation</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.ehrbase.openehr</groupId>
                <artifactId>terminology</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.ehrbase.openehr</groupId>
                <artifactId>test-data</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.ehrbase.openehr</groupId>
                <artifactId>opt-1.4</artifactId>
                <version>${project.version}</version>
            </dependency>
            <!-- external -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
                <version>2.2.4.RELEASE</version>
                <exclusions>
                    <exclusion>
                        <groupId>ch.qos.logback</groupId>
                        <artifactId>logback-classic</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.keycloak.bom</groupId>
                <artifactId>keycloak-adapter-bom</artifactId>
                <version>${keycloak.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.postgresql</groupId>
                <artifactId>postgresql</artifactId>
                <version>${postgressql.version}</version>
            </dependency>
            <dependency>
                <groupId>commons-io</groupId>
                <artifactId>commons-io</artifactId>
                <version>${commons.io.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>${commons.lang3.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-text</artifactId>
                <version>${commons-text.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-api</artifactId>
                <version>${log4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-core</artifactId>
                <version>${log4j.version}</version>
            </dependency>
            <dependency>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
                <version>1.2.17</version>
            </dependency>
            <dependency>
                <groupId>org.jooq</groupId>
                <artifactId>jooq</artifactId>
                <version>${jooq.version}</version>
                <scope>compile</scope>
            </dependency>
            <dependency>
                <groupId>org.jooq</groupId>
                <artifactId>jooq-codegen-maven</artifactId>
                <version>${jooq.version}</version>
            </dependency>
            <dependency>
                <groupId>org.antlr</groupId>
                <artifactId>antlr4-runtime</artifactId>
                <version>4.7.1</version>
            </dependency>
            <dependency>
                <groupId>com.jayway.jsonpath</groupId>
                <artifactId>json-path</artifactId>
                <version>${json.path.version}</version>
            </dependency>
            <dependency>
                <groupId>com.sun.jersey</groupId>
                <artifactId>jersey-json</artifactId>
                <version>1.19</version>
            </dependency>
            <dependency>
                <groupId>com.jayway.jsonpath</groupId>
                <artifactId>json-path-assert</artifactId>
                <version>${json.path.version}</version>
            </dependency>
            <dependency>
                <!--        <groupId>com.nedap.healthcare.archie</groupId>
                        <artifactId>archie-all</artifactId>
                        <version>0.7.0-SNAPSHOT</version>
                -->
                <groupId>com.github.openEHR</groupId>
                <artifactId>archie</artifactId>
                <version>738152e</version>
            </dependency>
            <dependency>
                <groupId>com.cedarsoftware</groupId>
                <artifactId>json-io</artifactId>
                <version>3.0.2</version>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-collections4</artifactId>
                <version>4.1</version>
            </dependency>
            <dependency>
                <groupId>commons-cli</groupId>
                <artifactId>commons-cli</artifactId>
                <version>1.3</version>
            </dependency>
            <dependency>
                <groupId>com.googlecode.jctree</groupId>
                <artifactId>jctree</artifactId>
                <version>2.0.0</version>
            </dependency>
            <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-core</artifactId>
                <version>${jackson.version}</version>
            </dependency>
            <dependency>
                <groupId>de.ruedigermoeller</groupId>
                <artifactId>fst</artifactId>
                <version>2.40</version>
            </dependency>
            <dependency>
                <groupId>org.jscience</groupId>
                <artifactId>jscience</artifactId>
                <version>4.3.1</version>
            </dependency>
            <dependency>
                <groupId>com.google.code.gson</groupId>
                <artifactId>gson</artifactId>
                <version>2.8.6</version>
            </dependency>
            <dependency>
                <groupId>org.apache.xmlbeans</groupId>
                <artifactId>xmlbeans</artifactId>
                <version>2.6.0</version>
            </dependency>
            <dependency>
                <groupId>org.apache.velocity</groupId>
                <artifactId>velocity</artifactId>
                <version>1.5</version>
            </dependency>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.11</version>
            </dependency>
            <dependency>
                <groupId>org.jdom</groupId>
                <artifactId>jdom</artifactId>
                <version>1.1.3</version>
            </dependency>
            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>28.1-jre</version>
            </dependency>
            <dependency>
                <groupId>org.json</groupId>
                <artifactId>json</artifactId>
                <version>20140107</version>
            </dependency>
            <dependency>
                <groupId>com.github.everit-org.json-schema</groupId>
                <artifactId>org.everit.json.schema</artifactId>
                <version>1.12.1</version>
            </dependency>
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger2</artifactId>
                <version>${springfox.version}</version>
                <!-- excluding and adding them with a custom version later resolves:
                https://github.com/springfox/springfox/issues/2265#issuecomment-413286451 -->
                <exclusions>
                    <exclusion>
                        <groupId>io.swagger</groupId>
                        <artifactId>swagger-annotations</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>io.swagger</groupId>
                        <artifactId>swagger-models</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>io.swagger</groupId>
                <artifactId>swagger-annotations</artifactId>
                <version>${swagger.version}</version>
            </dependency>
            <dependency>
                <groupId>io.swagger</groupId>
                <artifactId>swagger-models</artifactId>
                <version>${swagger.version}</version>
            </dependency>
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger-ui</artifactId>
                <version>${springfox.version}</version>
            </dependency>
            <dependency>
                <groupId>org.flywaydb</groupId>
                <artifactId>flyway-core</artifactId>
                <version>${flyway.version}</version>
            </dependency>

            <dependency>
                <groupId>org.xmlunit</groupId>
                <artifactId>xmlunit-core</artifactId>
                <version>2.2.1</version>
            </dependency>

            <dependency>
                <groupId>org.xmlunit</groupId>
                <artifactId>xmlunit-matchers</artifactId>
                <version>2.2.1</version>
            </dependency>

            <dependency>
                <groupId>javax.annotation</groupId>
                <artifactId>javax.annotation-api</artifactId>
                <version>1.3.2</version>
            </dependency>

            <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-web</artifactId>
                <version>${spring-security.version}</version>
            </dependency>

            <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-config</artifactId>
                <version>${spring-security.version}</version>
            </dependency>
            <!--  Test dependencies -->
            <dependency>
                <groupId>com.googlecode.junit-toolbox</groupId>
                <artifactId>junit-toolbox</artifactId>
                <version>${junit.toolbox.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.assertj</groupId>
                <artifactId>assertj-core</artifactId>
                <version>${assertj.core}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-test</artifactId>
                <version>${spring-security.version}</version>
                <scope>test</scope>
            </dependency>
             <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <!-- Annotations-->
        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
            <version>1.3.2</version>
        </dependency>
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
            <version>3.0.2</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>1.4.1</version>
                <configuration>
                    <rules>
                        <bannedDependencies>
                            <searchTransitive>true</searchTransitive>
                            <excludes>
                                <exclude>ch.qos.logback:logback-classic</exclude>
                            </excludes>
                        </bannedDependencies>
                    </rules>
                    <fail>true</fail>
                </configuration>
                <executions>
                    <execution>
                        <id>enforce-banned-dependencies</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>versions-maven-plugin</artifactId>
                <version>2.7</version>
                <configuration>
                    <generateBackupPoms>false</generateBackupPoms>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <release>11</release>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.8</version>
            </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>
                <version>3.1.1</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <additionalJOption>-Xdoclint:none</additionalJOption>
                </configuration>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.spotify</groupId>
                    <artifactId>dockerfile-maven-plugin</artifactId>
                    <version>1.4.13</version>
                    <configuration>
                        <dockerConfigFile></dockerConfigFile>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.antlr</groupId>
                    <artifactId>antlr4-maven-plugin</artifactId>
                    <version>4.7.1</version>
                    <configuration>
                        <listener>true</listener>
                        <visitor>true</visitor>
                    </configuration>
                    <executions>
                        <execution>
                            <id>antlr</id>
                            <goals>
                                <goal>antlr4</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>

                    <!-- Specify the maven code generator plugin -->
                    <!-- Use org.jooq            for the Open Source Edition
                             org.jooq.pro        for commercial editions,
                             org.jooq.pro-java-6 for commercial editions with Java 6 support,
                             org.jooq.trial      for the free trial edition

                         Note: Only the Open Source Edition is hosted on Maven Central.
                               Import the others manually from your distribution -->
                    <groupId>org.jooq</groupId>
                    <artifactId>jooq-codegen-maven</artifactId>
                    <version>${jooq.version}</version>

                    <!-- The plugin should hook into the generate goal -->
                    <executions>
                        <execution>
                            <phase>generate-sources</phase>
                            <goals>
                                <goal>generate</goal>
                            </goals>
                        </execution>
                    </executions>

                    <!-- Manage the plugin's dependency. In this example, we'll use a PostgreSQL database -->
                    <dependencies>
                        <dependency>
                            <groupId>org.postgresql</groupId>
                            <artifactId>postgresql</artifactId>
                            <version>${postgressql.version}</version>
                        </dependency>
                    </dependencies>

                    <!-- Specify the plugin configuration.
                         The configuration format is the same as for the standalone code generator -->
                    <configuration>
                        <!-- Configure the database connection here -->
                        <jdbc>
                            <driver>org.postgresql.Driver</driver>
                            <url>jdbc:postgresql://${database.host}:${database.port}/${database.name}</url>
                            <user>${database.user}</user>
                            <password>${database.pass}</password>
                        </jdbc>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.flywaydb</groupId>
                    <artifactId>flyway-maven-plugin</artifactId>
                    <version>${flyway.version}</version>
                    <dependencies>
                        <dependency>
                            <groupId>org.postgresql</groupId>
                            <artifactId>postgresql</artifactId>
                            <version>${postgressql.version}</version>
                        </dependency>
                    </dependencies>
                    <executions>
                        <execution>
                            <phase>generate-sources</phase>
                            <goals>
                                <goal>migrate</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
                <plugin>
                    <artifactId>maven-failsafe-plugin</artifactId>
                </plugin>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.19</version>
                    <configuration>
                        <useSystemClassLoader>false</useSystemClassLoader>
                        <systemPropertyVariables>
                            <test.db.host>${database.host}</test.db.host>
                            <test.db.port>${database.port}</test.db.port>
                            <test.db.name>${database.name}</test.db.name>
                            <test.db.user>${database.user}</test.db.user>
                            <test.db.password>${database.pass}</test.db.password>
                        </systemPropertyVariables>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>ossrh</id>
            <properties>
                <gpg.keyname>FAB0BE712374BFC3D26DA5B43A7041C227272DD8</gpg.keyname>
                <gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
            </properties>
            <build>
                <plugins>
                    <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>
                                <configuration>
 
                                </configuration>
                            </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>false</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
