<?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>io.javadog</groupId>
    <artifactId>cws</artifactId>
    <version>1.1.2</version>
    <packaging>pom</packaging>
    <name>CWS</name>
    <description>Parent pom for CWS, Cryptographic Web Store</description>
    <url>https://javadog.io/</url>

    <organization>
        <name>JavaDog.io</name>
        <url>https://javadog.io/</url>
    </organization>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <id>kim@dawn.dk</id>
            <name>Kim Nørregaard Jensen</name>
            <organization>JavaDog.io</organization>
            <organizationUrl>https://javadog.io/</organizationUrl>
            <roles>
                <role>developer</role>
            </roles>
        </developer>
    </developers>

    <modules>
        <module>cws-api</module>
        <module>cws-core</module>
        <module>cws-rest</module>
        <module>cws-soap</module>
        <module>cws-wildfly</module>
        <module>cws-payara</module>
        <module>cws-client-rest</module>
        <module>cws-client-soap</module>
        <module>cws-fitnesse</module>
    </modules>

    <scm>
        <url>scm:git:https://github.com/JavaDogs/cws.git</url>
        <connection>scm:git:https://github.com/JavaDogs/cws.git</connection>
        <developerConnection>scm:git:https://github.com/JavaDogs/cws.git</developerConnection>
    </scm>

    <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>

    <properties>
        <!-- Provided Dependencies -->
        <version.dependency.javaee>7.0</version.dependency.javaee>

        <!-- Dependencies for REST -->
        <version.dependency.gson>2.8.5</version.dependency.gson>

        <!-- Dependencies for SOAP -->
        <version.dependency.cxf>3.3.2</version.dependency.cxf>
        <version.dependency.xmlschema>2.2.4</version.dependency.xmlschema>
        <version.dependency.jaxws>2.3.1</version.dependency.jaxws>
        <version.dependency.jaxb.api>2.3.1</version.dependency.jaxb.api>
        <version.dependency.jaxb.core>2.3.0.1</version.dependency.jaxb.core>
        <version.dependency.jaxb.impl>2.3.2</version.dependency.jaxb.impl>
        <version.dependency.activation>1.1.1</version.dependency.activation>

        <!-- Dependencies for Test -->
        <version.dependency.junit>5.5.2</version.dependency.junit>
        <version.dependency.slf4j>1.7.28</version.dependency.slf4j>
        <version.dependency.logback>1.2.3</version.dependency.logback>
        <version.dependency.hibernate>5.4.4.Final</version.dependency.hibernate>
        <version.dependency.h2>1.4.199</version.dependency.h2>

        <!-- To avoid that the builds are platform specific -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <!-- SonarQube Settings -->
        <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
        <!-- The destination file for the code coverage report has to be set to
             the same value for each module pom. This will allow JaCoCo to sum
             up information in the same report, providing cross-module coverage. -->
        <sonar.jacoco.reportPaths>${project.basedir}/../target/jacoco.exec</sonar.jacoco.reportPaths>
        <!-- Sonar is by default analyzing everything. But Generated Code is
             beyond our control, so error reports from this is just annoying!
             Legend: *  - zero or more characters
                     ** - zero or more directories -->
        <sonar.exclusions>**/generated*/**,**/client/**,**/fitnesse/**</sonar.exclusions>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>cws-api</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>cws-core</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>cws-rest</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>cws-soap</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>cws-client-rest</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>cws-client-soap</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>javax</groupId>
                <artifactId>javaee-api</artifactId>
                <version>${version.dependency.javaee}</version>
            </dependency>

            <!-- Following is required to build & run the REST Client -->
            <dependency>
                <groupId>com.google.code.gson</groupId>
                <artifactId>gson</artifactId>
                <version>${version.dependency.gson}</version>
            </dependency>

            <!-- Following is required to build the SOAP Client. -->
            <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-rt-frontend-jaxws</artifactId>
                <version>${version.dependency.cxf}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-rt-transports-http</artifactId>
                <version>${version.dependency.cxf}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.cxf</groupId>
                <artifactId>cxf-rt-databinding-jaxb</artifactId>
                <version>${version.dependency.cxf}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.ws.xmlschema</groupId>
                <artifactId>xmlschema-core</artifactId>
                <version>${version.dependency.xmlschema}</version>
            </dependency>

            <!-- XML bindings have been removed from Java 9+ -->
            <dependency>
                <groupId>javax.xml.ws</groupId>
                <artifactId>jaxws-api</artifactId>
                <version>${version.dependency.jaxws}</version>
            </dependency>
            <dependency>
                <groupId>javax.xml.bind</groupId>
                <artifactId>jaxb-api</artifactId>
                <version>${version.dependency.jaxb.api}</version>
            </dependency>
            <dependency>
                <groupId>com.sun.xml.bind</groupId>
                <artifactId>jaxb-core</artifactId>
                <version>${version.dependency.jaxb.core}</version>
            </dependency>
            <dependency>
                <groupId>com.sun.xml.bind</groupId>
                <artifactId>jaxb-impl</artifactId>
                <version>${version.dependency.jaxb.impl}</version>
            </dependency>
            <dependency>
                <groupId>javax.activation</groupId>
                <artifactId>activation</artifactId>
                <version>${version.dependency.activation}</version>
            </dependency>

            <!-- Dependencies used for testing -->
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-engine</artifactId>
                <version>${version.dependency.junit}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>cws-core</artifactId>
                <version>${project.version}</version>
                <type>test-jar</type>
            </dependency>
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-core</artifactId>
                <version>${version.dependency.hibernate}</version>
            </dependency>
            <dependency>
                <groupId>com.h2database</groupId>
                <artifactId>h2</artifactId>
                <version>${version.dependency.h2}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${version.dependency.slf4j}</version>
            </dependency>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-classic</artifactId>
                <version>${version.dependency.logback}</version>
            </dependency>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-core</artifactId>
                <version>${version.dependency.logback}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>META-INF/**/*.xml</include>
                </includes>
            </testResource>
        </testResources>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.1</version>
                </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>javadoc</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-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.sonatype.plugins</groupId>
                    <artifactId>nexus-staging-maven-plugin</artifactId>
                    <version>1.6.7</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.22.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.1.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>3.2.3</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-shade-plugin</artifactId>
                    <version>3.2.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>1.6</version>
                </plugin>
                <plugin>
                    <groupId>org.owasp</groupId>
                    <artifactId>dependency-check-maven</artifactId>
                    <version>5.2.1</version>
                    <executions>
                        <execution>
                            <phase>verify</phase>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.wildfly.plugins</groupId>
                    <artifactId>wildfly-maven-plugin</artifactId>
                    <version>2.0.1.Final</version>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>0.8.4</version>
                </plugin>
                <plugin>
                    <groupId>org.sonarsource.scanner.maven</groupId>
                    <artifactId>sonar-maven-plugin</artifactId>
                    <version>3.6.1.1688</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>3.0.0</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <showDeprecation>true</showDeprecation>
                    <showWarnings>true</showWarnings>
                    <debug>false</debug>
                    <encoding>UTF-8</encoding>
                    <!-- Use "release" instead of these for Java 9+ -->
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <!-- Testing should be done in parallel if possible.
                         However, some of the CWS tests have been written in a
                         way, which is rather nasty, where default DB objects
                         have been deliberately altered, causing JDBC problems,
                         as it is not possible to acquire table locks.
                           It should be noted, that it is not a likely use-case
                         that Member Accounts are being removed and added in the
                         way, which the tests indicates. Hence, reverting to
                         running the tests sequentially has been decided, to
                         guarantee that all builds are green.
                           It is with sorrow that this decision was made, as the
                         parallel nature of the tests had the secondary goal of
                         ensuring that the system is also thread-safe. However,
                         the surefire plugin may run the tests parallel, but it
                         is with a predictable pattern, meaning that the same
                         build systems will always yield the same result. -->
                    <parallel>none</parallel>
                    <threadCount>10</threadCount>
                </configuration>
                <goals>
                    <goal>test</goal>
                </goals>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <configuration>
                    <destFile>${sonar.jacoco.reportPaths}</destFile>
                    <append>true</append>
                    <includes>
                        <include>io.javadog.cws.*</include>
                    </includes>
                </configuration>
                <executions>
                    <execution>
                        <id>pre-test</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>post-test</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <dataFile>${sonar.jacoco.reportPaths}</dataFile>
                            <outputDirectory>${project.basedir}/../target/jacoco</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <configuration>
                            <useAgent>true</useAgent>
                            <skip>false</skip>
                        </configuration>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <configuration>
                            <useAgent>true</useAgent>
                            <skip>false</skip>
                        </configuration>
                        <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>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
