<?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>de.rub.nds</groupId>
        <artifactId>protocol-toolkit-bom</artifactId>
        <version>3.2.4</version>
    </parent>

    <groupId>de.rub.nds.tls.scanner</groupId>
    <artifactId>tls-scanner</artifactId>
    <version>5.2.5</version>
    <packaging>pom</packaging>

    <name>TLS-Scanner</name>
    <description>TLS-Scanner is a tool created to assist pentesters and security researchers in the evaluation of TLS Server configurations.</description>
    <url>https://github.com/tls-attacker/TLS-Scanner</url>
    <inceptionYear>2017</inceptionYear>

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

    <developers>
        <developer>
            <id>ic0ns</id>
            <name>Robert Merget</name>
            <email>robert.merget@tii.ae</email>
            <url>https://github.com/ic0ns/</url>
            <organization>TII</organization>
            <organizationUrl>https://www.tii.ae/</organizationUrl>
            <roles>
                <role>Team lead</role>
            </roles>
        </developer>
    </developers>

    <modules>
        <module>Scanner-Core</module>
        <module>TLS-Client-Scanner</module>
        <module>TLS-Scanner-Core</module>
        <module>TLS-Server-Scanner</module>
    </modules>

    <scm>
        <connection>scm:git:https://github.com/tls-attacker/TLS-Scanner.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/tls-attacker/TLS-Scanner-Development.git</developerConnection>
        <tag>v5.2.5</tag>
        <url>https://github.com/tls-attacker/TLS-Scanner</url>
    </scm>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <main.basedir>${project.basedir}</main.basedir>
        <!-- The following variables are required for Jenkins CI -->
        <skipTests>false</skipTests>
        <skip.surefire.tests>${skipTests}</skip.surefire.tests>
        <skip.failsafe.tests>${skipTests}</skip.failsafe.tests>
    </properties>

    <!-- Override dependency versions from BOM for all submodules to match parent version -->
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>de.rub.nds.tls.scanner</groupId>
                <artifactId>scanner-core</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>de.rub.nds.tls.scanner</groupId>
                <artifactId>tls-client-scanner</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>de.rub.nds.tls.scanner</groupId>
                <artifactId>tls-scanner</artifactId>
                <version>${project.version}</version>
                <type>pom</type>
            </dependency>
            <dependency>
                <groupId>de.rub.nds.tls.scanner</groupId>
                <artifactId>tls-scanner-core</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>de.rub.nds.tls.scanner</groupId>
                <artifactId>tls-server-scanner</artifactId>
                <version>${project.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <!-- scope: compile -->
        <dependency>
            <groupId>com.beust</groupId>
            <artifactId>jcommander</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.dataformat</groupId>
            <artifactId>jackson-dataformat-yaml</artifactId>
        </dependency>
        <dependency>
            <groupId>com.github.wendykierp</groupId>
            <artifactId>JTransforms</artifactId>
            <version>3.1</version>
            <classifier>with-dependencies</classifier>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </dependency>
        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
        </dependency>
        <dependency>
            <groupId>de.rub.nds</groupId>
            <artifactId>asn1-tool</artifactId>
        </dependency>
        <dependency>
            <groupId>de.rub.nds</groupId>
            <artifactId>modifiable-variable</artifactId>
        </dependency>
        <dependency>
            <groupId>de.rub.nds</groupId>
            <artifactId>x509-attacker</artifactId>
        </dependency>
        <dependency>
            <groupId>de.rub.nds.tls.attacker</groupId>
            <artifactId>tls-core</artifactId>
        </dependency>
        <dependency>
            <groupId>de.rub.nds.tls.attacker</groupId>
            <artifactId>transport</artifactId>
        </dependency>
        <dependency>
            <groupId>de.rub.nds.tls.attacker</groupId>
            <artifactId>utils</artifactId>
        </dependency>
        <dependency>
            <groupId>jakarta.xml.bind</groupId>
            <artifactId>jakarta.xml.bind-api</artifactId>
        </dependency>
        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-math3</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcpkix-jdk15on</artifactId>
        </dependency>
        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcprov-jdk15on</artifactId>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jaxb</groupId>
            <artifactId>jaxb-runtime</artifactId>
        </dependency>
        <!-- scope: test -->
        <dependency>
            <groupId>de.rub.nds.tls.dockerlib</groupId>
            <artifactId>tls-docker-library</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.reflections</groupId>
            <artifactId>reflections</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <!--################# default lifecycle plugins #################-->
                <!-- Plugin to compile source files -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>${maven.compiler.source}</source>
                        <target>${maven.compiler.target}</target>
                    </configuration>
                </plugin>
                <!-- Plugin to execute unit tests -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                        <trimStackTrace>false</trimStackTrace>
                        <includes>
                            <include>**/*.java</include>
                        </includes>
                        <!-- Allow parallel execution of unit tests (execution in series within test classes) -->
                        <parallel>classes</parallel>
                        <!-- Can be adjusted depending on the local system, 3 should be a fair default value -->
                        <forkCount>3</forkCount>
                        <reuseForks>true</reuseForks>
                        <!-- By default we include all but integration tests during surefire execution -->
                        <excludedGroups>IntegrationTest</excludedGroups>
                        <skipTests>${skip.surefire.tests}</skipTests>
                    </configuration>
                </plugin>
                <!-- Plugin to compile javadoc -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <configuration>
                        <source>${maven.compiler.source}</source>
                        <javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
                    </configuration>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <!-- Pack source files to jar archive -->
                <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 to copy artifacts to apps folder -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>copy</id>
                            <goals>
                                <goal>copy</goal>
                            </goals>
                            <phase>package</phase>
                            <configuration>
                                <artifactItems>
                                    <artifactItem>
                                        <groupId>${project.groupId}</groupId>
                                        <artifactId>${project.artifactId}</artifactId>
                                        <version>${project.version}</version>
                                        <type>${project.packaging}</type>
                                        <destFileName>${project.build.finalName}.${project.packaging}</destFileName>
                                    </artifactItem>
                                </artifactItems>
                                <!--suppress UnresolvedMavenProperty -->
                                <outputDirectory>${maven.multiModuleProjectDirectory}/apps</outputDirectory>
                            </configuration>
                        </execution>
                        <execution>
                            <id>copy-dependencies</id>
                            <goals>
                                <goal>copy-dependencies</goal>
                            </goals>
                            <phase>package</phase>
                            <configuration>
                                <!--suppress UnresolvedMavenProperty -->
                                <outputDirectory>${maven.multiModuleProjectDirectory}/apps/lib</outputDirectory>
                                <!--Ensures only runnable dependencies are included-->
                                <includeScope>compile</includeScope>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <!-- Plugin to execute integration tests -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <configuration>
                        <!-- By default, the Failsafe plugin excludes various files. We have to override that. -->
                        <includes>
                            <include>**/*.java</include>
                        </includes>
                        <!-- Integration tests and slow tests are started -->
                        <groups>IntegrationTest</groups>
                        <skipITs>${skip.failsafe.tests}</skipITs>
                    </configuration>
                    <executions>
                        <execution>
                            <id>run-integration-tests</id>
                            <goals>
                                <goal>integration-test</goal>
                            </goals>
                            <phase>integration-test</phase>
                        </execution>
                        <execution>
                            <id>verify-integration-tests</id>
                            <goals>
                                <goal>verify</goal>
                            </goals>
                            <phase>verify</phase>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <!--################## clean lifecycle plugins ##################-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-clean</id>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                        <inherited>false</inherited>
                        <configuration>
                            <filesets>
                                <fileset>
                                    <!--suppress UnresolvedMavenProperty -->
                                    <directory>${maven.multiModuleProjectDirectory}/apps</directory>
                                </fileset>
                            </filesets>
                        </configuration>
                    </execution>
                    <execution>
                        <id>clean-apps-folder</id>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                        <phase>prepare-package</phase>
                        <inherited>false</inherited>
                        <configuration>
                            <excludeDefaultDirectories>true</excludeDefaultDirectories>
                            <filesets>
                                <fileset>
                                    <!--suppress UnresolvedMavenProperty -->
                                    <directory>${maven.multiModuleProjectDirectory}/apps</directory>
                                </fileset>
                            </filesets>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!--################# default lifecycle plugins #################-->
            <!-- Formatting -->
            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <configuration>
                    <java>
                        <lineEndings>GIT_ATTRIBUTES</lineEndings>
                        <trimTrailingWhitespace />
                        <endWithNewline />
                        <importOrder />
                        <removeUnusedImports />
                        <indent>
                            <spaces>true</spaces>
                            <spacesPerTab>4</spacesPerTab>
                        </indent>
                        <googleJavaFormat>
                            <version>1.16.0</version>
                            <style>AOSP</style>
                        </googleJavaFormat>
                        <licenseHeader>
                            <file>${main.basedir}/license_header_plain.txt</file>
                        </licenseHeader>
                    </java>
                    <pom>
                        <excludes>
                            <exclude>trust_stores_observatory/**</exclude>
                        </excludes>
                    </pom>
                    <markdown>
                        <excludes>
                            <exclude>trust_stores_observatory/**</exclude>
                        </excludes>
                    </markdown>
                </configuration>
            </plugin>
            <!-- Flatten pom.xml before install / deploy phases -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>flatten-maven-plugin</artifactId>
                <configuration>
                    <flattenMode>ossrh</flattenMode>
                </configuration>
                <executions>
                    <execution>
                        <id>flatten-clean</id>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                        <phase>clean</phase>
                    </execution>
                    <execution>
                        <id>flatten</id>
                        <goals>
                            <goal>flatten</goal>
                        </goals>
                        <phase>process-resources</phase>
                    </execution>
                </executions>
            </plugin>
            <!--############ plugins without lifecycle bindings #############-->
            <!-- Static code analysis -->
            <plugin>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>delayed-slow-tests</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <pluginManagement>
                    <plugins>
                        <!-- Configure Surefire to run SlowTests during integration-test phase to speed up the build process -->
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-surefire-plugin</artifactId>
                            <executions>
                                <execution>
                                    <id>default-test</id>
                                    <configuration>
                                        <excludedGroups>SlowTest,IntegrationTest</excludedGroups>
                                    </configuration>
                                </execution>
                                <execution>
                                    <id>run-slow-unit-tests</id>
                                    <goals>
                                        <goal>test</goal>
                                    </goals>
                                    <phase>integration-test</phase>
                                    <configuration>
                                        <groups>SlowTest</groups>
                                    </configuration>
                                </execution>
                            </executions>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>
        <profile>
            <id>coverage</id>
            <build>
                <pluginManagement>
                    <plugins>
                        <!-- Configure JaCoCo to run during unit and integration tests -->
                        <plugin>
                            <groupId>org.jacoco</groupId>
                            <artifactId>jacoco-maven-plugin</artifactId>
                            <executions>
                                <execution>
                                    <id>jacoco-prepare-agent</id>
                                    <goals>
                                        <goal>prepare-agent</goal>
                                    </goals>
                                </execution>
                                <execution>
                                    <id>jacoco-prepare-agent-it</id>
                                    <goals>
                                        <goal>prepare-agent-integration</goal>
                                    </goals>
                                </execution>
                                <execution>
                                    <id>jacoco-merge</id>
                                    <goals>
                                        <goal>merge</goal>
                                    </goals>
                                    <phase>post-integration-test</phase>
                                    <configuration>
                                        <destFile>${project.build.outputDirectory}/jacoco.merged.exec</destFile>
                                        <fileSets>
                                            <fileSet>
                                                <directory>${project.build.directory}</directory>
                                                <includes>
                                                    <include>jacoco.exec</include>
                                                    <include>jacoco-it.exec</include>
                                                </includes>
                                            </fileSet>
                                        </fileSets>
                                    </configuration>
                                </execution>
                                <execution>
                                    <id>jacoco-report</id>
                                    <goals>
                                        <goal>report</goal>
                                    </goals>
                                    <phase>verify</phase>
                                    <configuration>
                                        <dataFile>${project.build.outputDirectory}/jacoco.merged.exec</dataFile>
                                    </configuration>
                                </execution>
                            </executions>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>
    </profiles>
</project>
