<?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>
    <parent>
        <groupId>com.tesobe</groupId>
        <artifactId>obp-parent</artifactId>
        <relativePath>../pom.xml</relativePath>
        <version>1.10.1</version>
    </parent>
    <artifactId>obp-commons</artifactId>
    <packaging>jar</packaging>
    <name>Open Bank Project Commons</name>

    <repositories>
        <repository>
            <id>artima</id>
            <name>Artima Maven Repository</name>
            <url>http://repo.artima.com/releases</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>net.liftweb</groupId>
            <artifactId>lift-common_${scala.version}</artifactId>
        </dependency>
        <dependency>
            <groupId>net.liftweb</groupId>
            <artifactId>lift-util_${scala.version}</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>javax.activation</groupId>
                    <artifactId>activation</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.mail</groupId>
                    <artifactId>mail</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>net.liftweb</groupId>
            <artifactId>lift-mapper_${scala.version}</artifactId>
        </dependency>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-reflect</artifactId>
            <scope>compile</scope>
            <version>${scala.compiler}</version>
        </dependency>
        <dependency>
            <groupId>org.scalatest</groupId>
            <artifactId>scalatest_${scala.version}</artifactId>
        </dependency>
        <dependency>
            <groupId>org.scalactic</groupId>
            <artifactId>scalactic_${scala.version}</artifactId>
        </dependency>
        <dependency>
            <groupId>net.liftweb</groupId>
            <artifactId>lift-json_${scala.version}</artifactId>
            <version>${lift.version}</version>
        </dependency>
        <!-- InheritableThreadLocal enhancement-->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>transmittable-thread-local</artifactId>
            <version>2.11.5</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.12.0</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-text -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-text</artifactId>
            <version>1.10.0</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>32.0.0-jre</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${scala.version}</version>
                <configuration>
                    <skipTests>true</skipTests>
                </configuration>
            </plugin>
            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <!-- enable the scalatest plugin -->
                <groupId>org.scalatest</groupId>
                <artifactId>scalatest-maven-plugin</artifactId>
                <configuration>
                    <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
                    <forkMode>once</forkMode>
                    <junitxml>.</junitxml>
                    <filereports>WDF TestSuite.txt</filereports>
                    <argLine>-Drun.mode=test -XX:MaxMetaspaceSize=512m -Xms512m -Xmx512m</argLine>
                    <tagsToExclude>code.external</tagsToExclude>
                    <testFailureIgnore>${maven.test.failure.ignore}</testFailureIgnore>
                </configuration>
                <executions>
                    <execution>
                        <id>test</id>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-report-plugin</artifactId>
                <version>3.5.2</version>
                <configuration>
                    <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
                    <outputDirectory>${project.build.directory}/surefire-reports</outputDirectory>
                </configuration>
                <executions>
                    <execution>
                        <id>surefire-html-report</id>
                        <phase>package</phase>
                        <goals>
                            <goal>report-only</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>3.1.0</version>
                <executions>
                    <execution>
                        <id>delete-surefire-xml-after-html</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <delete>
                                    <fileset dir="${project.build.directory}/surefire-reports">
                                        <include name="TEST-*.xml"/>
                                        <include name="TESTS-*.xml"/>
                                    </fileset>
                                </delete>
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.0.1</version>
                <executions>
                    <execution>
                        <id>default-copy-resources</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <overwrite>true</overwrite>
                            <outputDirectory>${project.build.directory}</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${project.basedir}/src</directory>
                                    <includes>
                                        <include>packageLinkDefs.properties</include>
                                    </includes>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>dependency-check</id>
            <!-- ✅ Activates only if NVD_API_KEY is defined in environment -->
            <activation>
                <property>
                    <name>env.NVD_API_KEY</name>
                </property>
            </activation>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.owasp</groupId>
                        <artifactId>dependency-check-maven</artifactId>
                        <version>8.4.3</version>
                        <configuration>
                            <!-- Use NVD API 2.0 key from environment -->
                            <nvdApiKey>${env.NVD_API_KEY}</nvdApiKey>
                            <nvdApiServicesEnabled>true</nvdApiServicesEnabled>
                            <nvdDatafeedEnabled>false</nvdDatafeedEnabled>
                            <autoUpdate>true</autoUpdate>

                            <name>notifier-dependency-check</name>
                            <format>HTML</format>
                            <outputDirectory>${project.build.directory}/dependency-check-report</outputDirectory>
                            <failBuildOnCVSS>10</failBuildOnCVSS>
                            <failOnError>false</failOnError>
                            <skipProvidedScope>true</skipProvidedScope>
                            <skipRuntimeScope>true</skipRuntimeScope>
                            <skipTestScope>true</skipTestScope>
                            <skipArtifactType>pom</skipArtifactType>

                            <!-- Disable unnecessary analyzers -->
                            <ossindexAnalyzerEnabled>false</ossindexAnalyzerEnabled>
                            <nexusAnalyzerEnabled>false</nexusAnalyzerEnabled>
                            <centralAnalyzerEnabled>false</centralAnalyzerEnabled>
                            <retireJsAnalyzerEnabled>false</retireJsAnalyzerEnabled>
                            <knownExploitedEnabled>false</knownExploitedEnabled>
                            <assemblyAnalyzerEnabled>false</assemblyAnalyzerEnabled>
                        </configuration>

                        <executions>
                            <execution>
                                <id>dependency-check</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
