<?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>com.ibm.codey.bank</groupId>
    <artifactId>parent</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>pom</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <!-- Plugins -->
        <version.maven-war-plugin>3.2.2</version.maven-war-plugin>
        <version.maven-surefire-plugin>3.0.0-M1</version.maven-surefire-plugin>
        <version.maven-failsafe-plugin>3.0.0-M1</version.maven-failsafe-plugin>
    </properties>

    <dependencies>
       <!-- lombok -->
       <dependency>
           <groupId>org.projectlombok</groupId>
           <artifactId>lombok</artifactId>
           <version>1.18.16</version>
       </dependency>
       <!-- For tests -->
       <dependency>
           <groupId>junit</groupId>
           <artifactId>junit</artifactId>
           <version>4.13.1</version>
           <scope>test</scope>
       </dependency>
       <dependency>
           <groupId>org.apache.cxf</groupId>
           <artifactId>cxf-rt-rs-client</artifactId>
           <version>3.2.6</version>
           <scope>test</scope>
       </dependency>
       <dependency>
           <groupId>org.apache.cxf</groupId>
           <artifactId>cxf-rt-rs-extension-providers</artifactId>
           <version>3.2.6</version>
           <scope>test</scope>
       </dependency>
       <dependency>
           <groupId>org.glassfish</groupId>
           <artifactId>javax.json</artifactId>
           <version>1.1.4</version>
           <scope>test</scope>
       </dependency>
       <!-- Support for JDK 9 and above -->
       <dependency>
           <groupId>javax.xml.bind</groupId>
           <artifactId>jaxb-api</artifactId>
           <version>2.3.1</version>
	       <scope>test</scope>
       </dependency>
       <dependency>
           <groupId>com.sun.xml.bind</groupId>
           <artifactId>jaxb-core</artifactId>
           <version>2.3.0.1</version>
	       <scope>test</scope>
       </dependency>
       <dependency>
           <groupId>com.sun.xml.bind</groupId>
           <artifactId>jaxb-impl</artifactId>
           <version>2.3.2</version>
	       <scope>test</scope>
       </dependency>
       <dependency>
           <groupId>javax.activation</groupId>
           <artifactId>activation</artifactId>
           <version>1.1.1</version>
	       <scope>test</scope>
       </dependency>
       <!-- JSON-B provider for integration tests -->
       <dependency>
           <groupId>org.eclipse</groupId>
           <artifactId>yasson</artifactId>
           <version>1.0.1</version>
           <scope>test</scope>
       </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.openliberty.features</groupId>
                <artifactId>features-bom</artifactId>
                <version>19.0.0.12</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>${version.maven-war-plugin}</version>
                    <configuration>
                        <failOnMissingWebXml>false</failOnMissingWebXml>
                        <packagingExcludes>pom.xml</packagingExcludes>
                    </configuration>
                </plugin>
                <!-- Plugin to run unit tests -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${version.maven-surefire-plugin}</version>
                    <executions>
                        <execution>
                            <phase>test</phase>
                            <id>default-test</id>
                            <configuration>
                                <excludes>
                                    <exclude>**/it/**</exclude>
                                </excludes>
                                <reportsDirectory>
                                    ${project.build.directory}/test-reports/unit
                                </reportsDirectory>
                            </configuration>
                        </execution>
                    </executions>
                    <configuration>
                        <skipTests>${skipTests}</skipTests>
                    </configuration>
                </plugin>
                <!-- Plugin to run functional tests -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${version.maven-failsafe-plugin}</version>
                    <executions>
                        <execution>
                            <phase>integration-test</phase>
                            <id>integration-test</id>
                            <goals>
                                <goal>integration-test</goal>
                            </goals>
                            <configuration>
                                <includes>
                                    <include>**/it/**</include>
                                </includes>
                                <systemPropertyVariables>
                                    <liberty.test.port>${http.port}</liberty.test.port>
                                    <war.name>${app.name}</war.name>
                                </systemPropertyVariables>
                                <trimStackTrace>false</trimStackTrace>
                            </configuration>
                        </execution>
                        <execution>
                            <id>verify-results</id>
                            <goals>
                                <goal>verify</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <summaryFile>
                            ${project.build.directory}/test-reports/it/failsafe-summary.xml
                        </summaryFile>
                        <reportsDirectory>
                            ${project.build.directory}/test-reports/it
                        </reportsDirectory>
                    </configuration>
                </plugin>
		<plugin>
		  <groupId>org.apache.maven.plugins</groupId>
		  <artifactId>maven-compiler-plugin</artifactId>
		  <version>3.8.1</version>
		  <configuration>
		    <source>16</source>
		    <target>16</target>
		    <fork>true</fork>
		    <compilerArgs>
		      <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
		      <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
		      <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
		      <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
		      <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg>
		      <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg>
		      <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg>
		      <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
		      <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
		      <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED</arg>
		    </compilerArgs>
		    <annotationProcessorPaths>
		      <path>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<version>1.18.16</version>
		      </path>
		    </annotationProcessorPaths>
		  </configuration>
		</plugin>		
            </plugins>
        </pluginManagement>
    </build>

    <modules>
        <module>common</module>
        <module>transaction-service</module>
        <module>user-service</module>
        <module>integration-tests</module>
    </modules>

</project>
