<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (C) 2010-2021 Evolveum and contributors
  ~
  ~ This work is dual-licensed under the Apache License 2.0
  ~ and European Union Public License. See LICENSE file for details.
  -->

<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <!--
    Notes:
    - See https://maven.apache.org/developers/conventions/code.html for recommended element order.
    - Most information is inherited from this parent, no need to repeat license, organization, etc.
    - Some JAR modules are pure-test, no main sources - deploy/install is skipped for these, otherwise it fails with:
    "The packaging for this project did not assign a file to the build artifact"
    - Some modules have explicit maven.test.skip=true to disable test plugins coming from parents.
    - Maven's failsafe plugin is declared in build/plugin only in modules that need it.
    This by default uses testng-integration.xml suite file, but see property integrationTestSuite
    for other possibilities (mostly to make build faster by running only most important int-tests).
    - Test JARs of some modules are created, installed/deployed and used downstream (search for test-jar).

    VARIOUS MVN COMMANDS (with rough times on average notebook)
    Note: Javadoc takes long time but it's only part of the "dist" profile (active by default).
    Hence, " -Dmaven.javadoc.skip" is not necessary with "-P -dist".

    Quick developer's run without any tests, skipping distribution (~6m):
    mvn clean install -P -dist -DskipTests

    "Quick" build with unit tests only and checkstyle (~30m):
    mvn clean install -P -dist -DskipITs

    "Quick" build with smaller/faster set of integration test (~1h20m):
    mvn clean install -P -dist -DintegrationTestSuite=fast

    Default build - creates distribution package, runs all tests except "extra" tests ():
    mvn clean install

    Extra test run with custom JVM args (we have 16g on CI server, but it works without args too),
    runs just under 900 tests, skips distribution and any common unit/IT tests (~1h50m):
    mvn clean install -P extratest,-dist -Dsurefire.args="-Xmx8g" -Dfailsafe.args="-Xmx8g -Duser.language=en"
    (Skipping of default tests is managed by "extratest" profile.)

    Extra test run for a single module, -D property matches the module in -pl:
    mvn clean install -DskipConnTests=false -pl testing/conntest

    Running a single IT test class in one module from the "extra" set with output to stdout:
    mvn integration-test -DskipConnTests=false -DredirectTestOutputToFile=false -pl testing/conntest -Dit.test=TestAdLdapChimera
    Note usage of "it.test" property (for failsafe), not just "test" (for surefire).

    Full build with extra tests for a single module, "-DskipTests" suppresses other default tests:
    mvn clean install -P -dist -DskipTests -DskipStoryTests=false
    See "extratest" profile in testing/pom.xml for all individual properties enabling extra tests.

    Running a single IT test class from story tests with remote debugger:
    mvn integration-test -DskipStoryTests=false -DredirectTestOutputToFile=false \
      -Dmaven.failsafe.debug="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005" \
      -pl testing/story -Dit.test=TestSystemPerformance
    Note the "maven.failsafe.debug", it is possible to use "maven.surefire.debug" (with -Dtest) too.
    Change to "suspend=y" for the test to wait for the debugger (e.g. debugging the startup).
    See: https://maven.apache.org/surefire/maven-surefire-plugin/examples/debugging.html
    and https://maven.apache.org/surefire/maven-failsafe-plugin/examples/debugging.html

    Running unit+IT tests of a selected module (-pl) with output to stdout:
    mvn clean install -DredirectTestOutputToFile=false -pl model/model-intest
    -->

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>2.5.2</version>
        <!-- This parent also declares dependencies listed here:
        https://docs.spring.io/spring-boot/docs/2.5.2/reference/html/dependency-versions.html#dependency-versions
        Or for current version of Spring Boot:
        https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-dependency-versions.html
        -->
    </parent>

    <groupId>com.evolveum.prism</groupId>
    <artifactId>prism-parent</artifactId>
    <version>4.4-M2</version>
    <packaging>pom</packaging>

    <name>Prism Project</name>
    <description>Utility module to compile all of the maven based Prism projects.</description>
    <organization>
        <name>evolveum</name>
        <url>https://www.evolveum.com</url>
    </organization>
    <licenses>
        <license>
            <name>Apache License v2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <modules>
        <module>tools</module>
        <module>infra</module>
    </modules>

    <scm>
        <connection>https://github.com/Evolveum/prism.git</connection>
        <developerConnection>git@github.com:Evolveum/prism.git</developerConnection>
        <url>https://github.com/Evolveum/prism.git</url>
    </scm>
    <issueManagement>
        <system>Atlassian JIRA</system>
        <url>https://jira.evolveum.com/browse/MID</url>
    </issueManagement>


    <distributionManagement>
        <repository>
            <id>evolveum-nexus</id>
            <name>Internal Releases</name>
            <url>https://nexus.evolveum.com/nexus/content/repositories/releases/</url>
        </repository>
        <snapshotRepository>
            <id>evolveum-nexus</id>
            <name>Internal Snapshots</name>
            <url>https://nexus.evolveum.com/nexus/content/repositories/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>


    <properties>
        <!-- Build system options -->
        <!-- Encoding for both sources and resources -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.source.version>11</project.source.version>
        <project.build.locale>en_US</project.build.locale>
        <ansi.color>true</ansi.color>
        <verbose.jaxb2>false</verbose.jaxb2>
        <verbose.jaxws>false</verbose.jaxws>

        <!--suppress UnresolvedMavenProperty (for IDE development) -->
        <git.describe>${describe}</git.describe>
        <timestamp>${maven.build.timestamp}</timestamp>
        <maven.build.timestamp.format>EEE, d MMM yyyy HH:mm:ss Z</maven.build.timestamp.format>

        <!-- JVM args for testing plugins, can be used to add profiling, etc. -->
        <surefire.args>-Xms1024m -Xmx4096m</surefire.args>
        <failsafe.args>-Xms1024m -Xmx4096m -Duser.language=en</failsafe.args>
        <!--
        Some modules support "full" or "fast" suite for integration tests.
        This can be used as command line switch for mvn: -DintegrationTestSuite=fast
        See model/model-intest for example, how to do it.
        -->
        <integrationTestSuite>full</integrationTestSuite>
        <!-- Controls both surefire and failsafe config/redirectTestOutputToFile setting. -->
        <redirectTestOutputToFile>true</redirectTestOutputToFile>

        <!-- Dependencies global versions -->
        <commons.io.version>2.9.0</commons.io.version>
        <commons.lang.version>2.6</commons.lang.version>
        <quartz.version>2.3.2.e1</quartz.version>
        <selenium.version>3.141.59</selenium.version>
        <slf4j.version>1.7.30</slf4j.version>
        <logback.version>1.2.3e1</logback.version>
        <testng.version>7.4.0</testng.version>
        <xml.resolver.version>1.2</xml.resolver.version>
        <hibernate.version>5.5.0.Final</hibernate.version>
        <!--
        Default Spring Boot 2.4.3 uses H2 1.4.200 but that one has NPE bug:
        https://github.com/h2database/h2database/issues/1808
        Sometimes occurs on heavy concurrent test, e.g. on TestDummyParallelism, but also during app run.
        This bug was introduced in 1.4.198, which was major version that also changed queries in OrgClosureManager.
        Between 1.4.197 and 198 changes of OrgClosureManager and around MVCC must be made (see commit history).
        With 1.4.200 TestObjectLifecycleApprovalGlobal fails consistently.
        197 is the last version that does not require code changes, but self-corrupts DB sometimes (MID-6510).
        193 was used for 4 years with few problems, so it's still here to stay.
        -->
        <h2.version>1.4.193</h2.version>
        <!-- Spring Boot parent declares most fresh versions for JDBC drivers for all our servers -->
        <!-- Groovy 3.0.8 is also default for Spring Boot 2.5.0 -->
        <groovy.version>3.0.8</groovy.version>
        <derby.version>10.15.2.0</derby.version>
        <surefire.version>3.0.0-M5</surefire.version>
        <reflections.version>0.9.12</reflections.version>
        <guava.version>30.1.1-jre</guava.version>
        <failsafe.version>3.0.0-M5</failsafe.version>
        <jetty.version>11.0.4</jetty.version>
        <maven.api.version>3.8.1</maven.api.version>
        <checkstyle.version>3.1.2</checkstyle.version>
        <xalan.version>2.7.2</xalan.version>
        <xerces.version>2.12.1</xerces.version>

        <asciidoclet.version>1.5.6</asciidoclet.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.reflections</groupId>
                <artifactId>reflections</artifactId>
                <version>${reflections.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>com.google.guava</groupId>
                        <artifactId>guava</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-classic</artifactId>
                <version>${logback.version}</version>
            </dependency>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-core</artifactId>
                <version>${logback.version}</version>
            </dependency>

            <!--
            TODO: Originally in jdk-11 profile, consolidate, now, when JDK 8 is not needed anymore.
            In JDK 11 we want to get rid of xml-apis, that are covered by Java 9+.
            Comes with xerces/xalan, overrides many classes from other APIs (StAX, SAX) or JDK.
            But it contains DOM classes like org.w3c.dom.ElementTraversal that are available
            from JDK 9+, so we still need it with JDK 8, among others in schemadist-prism.
            BTW: 1.4 (from 2009) is NEWER version than 2.0.2 (2002)... what can you say...
            -->
            <dependency>
                <groupId>xerces</groupId>
                <artifactId>xercesImpl</artifactId>
                <version>${xerces.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>xml-apis</groupId>
                        <artifactId>xml-apis</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>xalan</groupId>
                <artifactId>serializer</artifactId>
                <version>${xalan.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>xml-apis</groupId>
                        <artifactId>xml-apis</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <!--
            TODO: we should get rid of xalan/xerces if possible.
            More (from 2015): http://www.odi.ch/weblog/posting.php?posting=689
            ForgeRock got rid of it: https://bugster.forgerock.org/jira/browse/OPENAM-7320
            -->
            <dependency>
                <groupId>xalan</groupId>
                <artifactId>xalan</artifactId>
                <version>${xalan.version}</version>
            </dependency>
            <dependency>
                <groupId>org.codehaus.staxmate</groupId>
                <artifactId>staxmate</artifactId>
                <version>2.0.1</version>
                <exclusions>
                    <exclusion>
                        <groupId>stax</groupId>
                        <artifactId>stax-api</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>net.sourceforge.ccxjc</groupId>
                <artifactId>cc-xjc-plugin</artifactId>
                <version>2.0.1</version>
            </dependency>
            <dependency>
                <groupId>commons-codec</groupId>
                <artifactId>commons-codec</artifactId>
                <version>1.15</version>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-text</artifactId>
                <version>1.9</version>
            </dependency>
            <!-- experimental -->
            <dependency>
                <groupId>com.google.code.findbugs</groupId>
                <artifactId>jsr305</artifactId>
                <version>3.0.2</version>
            </dependency>
            <dependency>
                <groupId>commons-io</groupId>
                <artifactId>commons-io</artifactId>
                <version>${commons.io.version}</version>
            </dependency>
            <dependency>
                <groupId>commons-lang</groupId>
                <artifactId>commons-lang</artifactId>
                <version>${commons.lang.version}</version>
            </dependency>
            <dependency>
                <groupId>org.jetbrains</groupId>
                <artifactId>annotations</artifactId>
                <version>21.0.1</version>
            </dependency>
            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>${guava.version}</version>
            </dependency>

            <dependency>
                <!-- this replaces commons-logging and spring-jcl (or other JARs with org.apache.commons.logging.Log) -->
                <groupId>org.slf4j</groupId>
                <artifactId>jcl-over-slf4j</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>log4j-over-slf4j</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-core</artifactId>
                <version>${spring-framework.version}</version>
                <exclusions>
                    <!-- replaced with jcl-over-slf4j -->
                    <exclusion>
                        <groupId>org.springframework</groupId>
                        <artifactId>spring-jcl</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>

            <dependency>
                <groupId>xml-resolver</groupId>
                <artifactId>xml-resolver</artifactId>
                <version>${xml.resolver.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.velocity</groupId>
                <artifactId>velocity</artifactId>
                <version>1.7</version>
            </dependency>

            <dependency>
                <groupId>org.jvnet.jaxb2_commons</groupId>
                <artifactId>jaxb2-basics-runtime</artifactId>
                <version>1.11.1</version>
            </dependency>

            <dependency>
                <groupId>org.javasimon</groupId>
                <artifactId>javasimon-core</artifactId>
                <version>4.2.0</version>
            </dependency>

            <!-- Maven plugins -->
            <dependency>
                <groupId>org.apache.maven</groupId>
                <artifactId>maven-plugin-api</artifactId>
                <version>${maven.api.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.codehaus.plexus</groupId>
                        <artifactId>plexus-component-annotations</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.codehaus.plexus</groupId>
                        <artifactId>plexus-classworlds</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.apache.maven</groupId>
                <artifactId>maven-model</artifactId>
                <version>${maven.api.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.maven</groupId>
                <artifactId>maven-artifact</artifactId>
                <version>${maven.api.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.maven</groupId>
                <artifactId>maven-core</artifactId>
                <version>${maven.api.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.maven</groupId>
                <artifactId>maven-archiver</artifactId>
                <version>3.5.1</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.codehaus.plexus</groupId>
                        <artifactId>plexus-container-default</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.codehaus.plexus</groupId>
                        <artifactId>plexus-component-annotations</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.slf4j</groupId> <!-- We do not want multiple SLF4J implementations -->
                        <artifactId>slf4j-jdk14</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.apache.maven.shared</groupId>
                        <artifactId>maven-shared-utils</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.codehaus.plexus</groupId>
                        <artifactId>plexus-interpolation</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.codehaus.plexus</groupId>
                <artifactId>plexus-archiver</artifactId>
                <version>4.2.5</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.slf4j</groupId> <!-- We do not want multiple SLF4J implementations -->
                        <artifactId>slf4j-jdk14</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <!-- Used by maven-plugin-api in schema-dist-maven-plugin -->
            <dependency>
                <groupId>org.codehaus.plexus</groupId>
                <artifactId>plexus-utils</artifactId>
                <version>3.3.0</version>
            </dependency>
            <dependency>
                <groupId>org.codehaus.plexus</groupId>
                <artifactId>plexus-io</artifactId>
                <version>3.2.0</version>
            </dependency>
            <dependency>
                <groupId>org.codehaus.plexus</groupId>
                <artifactId>plexus-interactivity-api</artifactId>
                <version>1.0</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.codehaus.plexus</groupId>
                        <artifactId>plexus-classworlds</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.apache.maven.plugin-tools</groupId>
                <artifactId>maven-plugin-annotations</artifactId>
                <version>3.6.1</version>
                <scope>provided</scope>
            </dependency>

            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-collections4</artifactId>
                <version>4.4</version>
            </dependency>

            <!-- Test support dependencies -->
            <dependency>
                <groupId>org.testng</groupId>
                <artifactId>testng</artifactId>
                <version>${testng.version}</version>
            </dependency>
            <dependency>
                <groupId>com.evolveum.commons</groupId>
                <artifactId>test-ng</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.antlr</groupId>
                <artifactId>antlr4-runtime</artifactId>
                <version>4.9.2</version>
            </dependency>

            <dependency>
                <groupId>jakarta.xml.ws</groupId>
                <artifactId>jakarta.xml.ws-api</artifactId>
                <version>3.0.1</version>
                <scope>runtime</scope>
            </dependency>
            <dependency>
                <groupId>jakarta.jws</groupId>
                <artifactId>jakarta.jws-api</artifactId>
                <version>3.0.0</version>
                <scope>runtime</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <!-- We don't want any dependencies in parent POM. -->

    <repositories>
        <repository>
            <id>evolveum</id>
            <name>Evolveum Public Releases</name>
            <url>https://nexus.evolveum.com/nexus/content/groups/public/</url>
        </repository>
        <repository>
            <id>evolveum-snapshots</id>
            <name>Evolveum Snapshots</name>
            <url>https://nexus.evolveum.com/nexus/content/repositories/snapshots/</url>
        </repository>
        <repository>
            <id>spring-milestone</id>
            <name>Spring Milestone Repository</name>
            <url>https://repo.spring.io/milestone</url>
        </repository>

        <!--
        We need this for Sleepycat JE, version 5.0.73 is released OK, but newer versions
        (like 5.0.103) is in Maven central plugin repository, which is obviously wrong.
        So we need Oracle's repo too.
        -->
        <repository>
            <id>oracle</id>
            <name>Oracle</name>
            <url>https://download.oracle.com/maven/</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>evolveum</id>
            <name>Evolveum</name>
            <url>https://nexus.evolveum.com/nexus/content/groups/public</url>
        </pluginRepository>
    </pluginRepositories>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.1.0</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.lukegb.mojo</groupId>
                <artifactId>gitdescribe-maven-plugin</artifactId>
                <version>3.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>gitdescribe</goal>
                        </goals>
                        <id>git-describe</id>
                        <phase>initialize</phase>
                        <configuration>
                            <outputPrefix></outputPrefix>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <skipIfEmpty>true</skipIfEmpty>
                    <archive>
                        <manifestEntries>
                            <Version-Number>${project.version}</Version-Number>
                            <SCM-Revision>${git.describe}</SCM-Revision>
                            <Organization>Evolveum</Organization>
                            <Organization-URL>https://www.evolveum.com</Organization-URL>
                            <Bugtracking-System>https://jira.evolveum.com</Bugtracking-System>
                            <License>dual-licensed under the Apache License 2.0 and European Union Public License</License>
                            <License-URL>https://www.apache.org/licenses/LICENSE-2.0.txt and https://joinup.ec.europa.eu/collection/eupl/eupl-text-11-12</License-URL>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.2.3</version>
                <configuration>
                    <archive>
                        <manifestEntries>
                            <Version-Number>${project.version}</Version-Number>
                            <SCM-Revision>${git.describe}</SCM-Revision>
                            <Organization>Evolveum</Organization>
                            <Organization-URL>https://www.evolveum.com</Organization-URL>
                            <Bugtracking-System>https://jira.evolveum.com</Bugtracking-System>
                            <License>dual-licensed under the Apache License 2.0 and European Union Public License</License>
                            <License-URL>https://www.apache.org/licenses/LICENSE-2.0.txt and https://joinup.ec.europa.eu/collection/eupl/eupl-text-11-12</License-URL>
                        </manifestEntries>
                    </archive>
                    <attachClasses>true</attachClasses>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>

            <plugin>
                <groupId>pl.project13.maven</groupId>
                <artifactId>git-commit-id-plugin</artifactId>
                <version>3.0.1</version>
                <!-- Used in system-init module. -->
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.3</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enforce</id>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>3.6</version>
                                </requireMavenVersion>
                                <dependencyConvergence/>
                                <bannedDependencies>
                                    <excludes>
                                        <!-- both replaced by org.slf4j:jcl-over-slf4j -->
                                        <exclude>commons-logging:commons-logging</exclude>
                                        <exclude>org.springframework:spring-jcl</exclude>
                                        <!--
                                        jaxb-core replaced by Glassfish jaxb-runtime + txw2
                                        jaxb-xjc replaced by Glassfish jaxb-xjc + xsom + codemodel
                                        -->
                                        <exclude>com.sun.xml.bind:*</exclude>
                                        <!-- in favor of jakarta.xml.bind:jakarta.xml.bind-api -->
                                        <exclude>javax.xml.bind:jaxb-api</exclude>
                                        <!-- in favor of jakarta.activation:jakarta.activation-api -->
                                        <exclude>javax.activation:javax.activation-api</exclude>
                                        <!-- in favor of com.sun.activation:jakarta.activation -->
                                        <exclude>com.sun.activation:javax.activation</exclude>
                                        <exclude>javax.activation:activation</exclude>
                                        <!-- in favor of jakarta.annotation:jakarta.annotation-api -->
                                        <exclude>javax.annotation:javax.annotation-api</exclude>
                                        <!-- package with multiple XML APIs, conflicts assured
                                        (WE CAN'T YET see todo at the xalan/xerces dep declarations above) -->
                                        <!--<exclude>xml-apis:xml-apis</exclude>-->
                                    </excludes>
                                </bannedDependencies>
                            </rules>
                        </configuration>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.1.2</version>
                <dependencies>
                    <dependency>
                        <groupId>org.ow2.asm</groupId>
                        <artifactId>asm</artifactId>
                        <version>9.1</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>analyze</id>
                        <goals>
                            <goal>analyze-only</goal>
                        </goals>
                        <configuration>
                            <failOnWarning>true</failOnWarning>
                            <ignoreNonCompile>true</ignoreNonCompile>
                            <ignoredUnusedDeclaredDependencies>
                                <!--
                                We don't want anything here, except for test support...
                                In case of false report, check that the dependency is not used only in unused imports.
                                -->
                                <ignoredUnusedDeclaredDependency>org.assertj:assertj-core</ignoredUnusedDeclaredDependency>
                            </ignoredUnusedDeclaredDependencies>
                            <ignoredUsedUndeclaredDependencies>
                                <!--
                                TODO: Experimental proposal for midpoint packages, but if there is no disagreement, just delete this todo in 2021 :-)
                                Anything from midPoint is in one version, no conflict should occur and there is no real
                                need to declare transitive dependencies (e.g. *-impl implying *-api, etc.).
                                -->
                                <ignoredUsedUndeclaredDependency>com.evolveum.midpoint.*:*</ignoredUsedUndeclaredDependency>

                                <!-- Testing dependencies are not troubling us from. -->
                                <ignoredUsedUndeclaredDependency>org.testng:testng</ignoredUsedUndeclaredDependency>
                                <ignoredUsedUndeclaredDependency>org.assertj:assertj-core</ignoredUsedUndeclaredDependency>
                                <ignoredUsedUndeclaredDependency>org.javasimon:javasimon-core</ignoredUsedUndeclaredDependency>

                                <!-- Unreliable detection -->
                                <ignoredUsedUndeclaredDependency>javax.xml.bind:jaxb-api</ignoredUsedUndeclaredDependency>

                                <!-- the latter is superset of API and this totally confuses dep analyzer-->
                                <ignoredUsedUndeclaredDependency>jakarta.activation:jakarta.activation-api</ignoredUsedUndeclaredDependency>
                                <ignoredUsedUndeclaredDependency>com.sun.activation:jakarta.activation</ignoredUsedUndeclaredDependency>

                                <!-- needs to much exclusions, used by apache-cxf (xjc plugin, prism-impl, schema, ..) -->
                                <ignoredUsedUndeclaredDependency>jakarta.xml.bind:jakarta.xml.bind-api</ignoredUsedUndeclaredDependency>
                                <ignoredUsedUndeclaredDependency>org.glassfish.jaxb:xsom</ignoredUsedUndeclaredDependency>
                                <ignoredUsedUndeclaredDependency>org.glassfish.jaxb:jaxb-runtime</ignoredUsedUndeclaredDependency>

                                <!-- Falsely reported, not used explicitly, only transient dependency. -->
                                <ignoredUsedUndeclaredDependency>org.slf4j:jcl-over-slf4j</ignoredUsedUndeclaredDependency>
                                <ignoredUsedUndeclaredDependency>org.slf4j:slf4j-api</ignoredUsedUndeclaredDependency>
                                <ignoredUsedUndeclaredDependency>org.danekja:jdk-serializable-functional</ignoredUsedUndeclaredDependency>
                                <ignoredUsedUndeclaredDependency>org.apache.tomcat.embed:tomcat-embed-core</ignoredUsedUndeclaredDependency>
                            </ignoredUsedUndeclaredDependencies>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${checkstyle.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>com.puppycrawl.tools</groupId>
                        <artifactId>checkstyle</artifactId>
                        <version>8.43</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <!--suppress MavenModelInspection: provided by mvn(w)/IDE/Jenkins -->
                    <configLocation>${maven.multiModuleProjectDirectory}/config/checkstyle/checkstyle.xml</configLocation>
                    <!--suppress MavenModelInspection: provided by mvn(w)/IDE/Jenkins -->
                    <suppressionsLocation>${maven.multiModuleProjectDirectory}/config/checkstyle/checkstyle-suppressions.xml</suppressionsLocation>
                    <encoding>UTF-8</encoding>
                    <consoleOutput>true</consoleOutput>
                    <failsOnError>true</failsOnError>
                    <linkXRef>false</linkXRef>
                    <includes>**/*.java</includes>
                    <!-- Also need to add suffixes to checkstyle.xml -->
                    <resourceIncludes>**/*.properties,**/*.xml,**/*.xsd,**/*.wsdl,**/*.json,**/*.yaml,**/*.yml</resourceIncludes>
                </configuration>
                <executions>
                    <execution>
                        <id>validate</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.0</version>
                    <configuration>
                        <source>${project.source.version}</source>
                        <target>${project.source.version}</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.1.0</version>
                </plugin>
                <plugin>
                    <groupId>com.rimerosolutions.maven.plugins</groupId>
                    <artifactId>wrapper-maven-plugin</artifactId>
                    <version>0.0.4</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-plugin-plugin</artifactId>
                    <version>3.6.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>2.8.2</version>
                    <!--
                    With 3.0.0-M1 javadoc module fails with:
                    The packaging plugin for this project did not assign a main file to the project but it has attachments. Change packaging to 'pom'.
                    -->
                    <!--<version>3.0.0-M1</version>-->
                    <configuration>
                        <deployAtEnd>true</deployAtEnd>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.apache.maven.plugins</groupId>
                                        <artifactId>maven-dependency-plugin</artifactId>
                                        <versionRange>[3.1.1,)</versionRange>
                                        <goals>
                                            <goal>copy-dependencies</goal>
                                            <goal>unpack</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <execute/>
                                    </action>
                                </pluginExecution>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.apache.cxf</groupId>
                                        <artifactId>cxf-codegen-plugin</artifactId>
                                        <versionRange>[3.3.1,)</versionRange>
                                        <goals>
                                            <goal>wsdl2java</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <execute/>
                                    </action>
                                </pluginExecution>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>com.lukegb.mojo</groupId>
                                        <artifactId>gitdescribe-maven-plugin</artifactId>
                                        <versionRange>[3.0,)</versionRange>
                                        <goals>
                                            <goal>gitdescribe</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <execute/>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${surefire.version}</version>
                    <executions>
                        <execution>
                            <id>default-test</id> <!-- unit tests -->
                            <phase>test</phase>
                            <goals>
                                <goal>test</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <parallel>false</parallel>
                        <forkCount>1</forkCount>
                        <reuseForks>true</reuseForks>
                        <redirectTestOutputToFile>${redirectTestOutputToFile}</redirectTestOutputToFile>
                        <trimStackTrace>false</trimStackTrace>
                        <!-- See https://issues.apache.org/jira/browse/SUREFIRE-1588 -->
                        <useSystemClassLoader>false</useSystemClassLoader>
                        <systemPropertyVariables>
                            <javax.net.ssl.trustStore>src/test/resources/truststore.jks</javax.net.ssl.trustStore>
                            <midpoint.home>target/midpoint-home</midpoint.home>
                            <java.util.logging.config.file>${project.build.directory}/test-classes/logging.properties
                            </java.util.logging.config.file>
                        </systemPropertyVariables>
                        <argLine>${surefire.args}</argLine>
                        <suiteXmlFiles>
                            <suiteXmlFile>testng-unit.xml</suiteXmlFile>
                        </suiteXmlFiles>
                        <properties>
                            <property>
                                <name>suitename</name>
                                <value>Unit</value>
                            </property>
                            <property>
                                <name>listener</name>
                                <value>
                                    com.evolveum.midpoint.tools.testng.TestListener,com.evolveum.midpoint.tools.testng.RetryListener
                                </value>
                            </property>
                        </properties>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.apache.maven.surefire</groupId>
                            <artifactId>surefire-testng</artifactId>
                            <version>${surefire.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${failsafe.version}</version>
                    <executions>
                        <execution>
                            <id>integration-test</id>
                            <phase>integration-test</phase>
                            <goals>
                                <goal>integration-test</goal>
                                <goal>verify</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <redirectTestOutputToFile>${redirectTestOutputToFile}</redirectTestOutputToFile>
                        <systemPropertyVariables>
                            <javax.net.ssl.trustStore>src/test/resources/truststore.jks</javax.net.ssl.trustStore>
                            <midpoint.home>target/midpoint-home</midpoint.home>
                            <java.util.logging.config.file>${project.build.directory}/test-classes/logging.properties</java.util.logging.config.file>
                        </systemPropertyVariables>
                        <argLine>${failsafe.args}</argLine>
                        <suiteXmlFiles>
                            <suiteXmlFile>testng-integration.xml</suiteXmlFile>
                        </suiteXmlFiles>
                        <properties>
                            <property>
                                <name>suitename</name>
                                <value>Integration</value>
                            </property>
                            <property>
                                <name>listener</name>
                                <value>com.evolveum.midpoint.tools.testng.TestListener,com.evolveum.midpoint.tools.testng.RetryListener</value>
                            </property>
                        </properties>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>findbugs-maven-plugin</artifactId>
                    <version>3.0.5</version>
                    <configuration>
                        <effort>Max</effort>
                        <threshold>Low</threshold>
                        <xmlOutput>true</xmlOutput>
                        <onlyAnalyze>com.evolveum.midpoint.*</onlyAnalyze>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>3.3.0</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>findbugs-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <!-- TODO: unify with other checkstyle setup in pluginManagement? -->
                <version>${checkstyle.version}</version>
                <configuration>
                    <!--suppress MavenModelInspection: provided by mvn(w)/IDE/Jenkins -->
                    <configLocation>${maven.multiModuleProjectDirectory}/build-system/checkstyle-configs/checkstyle.xml</configLocation>
                    <!-- TODO: what about suppressions? without them and with failsOnError true it must fail, or not? -->
                    <encoding>UTF-8</encoding>
                    <consoleOutput>true</consoleOutput>
                    <failsOnError>true</failsOnError>
                    <linkXRef>false</linkXRef>
                </configuration>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>checkstyle</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
        </plugins>
    </reporting>

    <profiles>
        <!--
        Activating extra tests (tests under testing module), skipping other tests.
        Often we want to combine with disabling dist: -P extratest,-dist
        See testing/pom.xml for more on "extra" tests, but we need to skip tests here to disable
        the default unit/integration tests covered by default "mvn clean install" build.
        -->
        <profile>
            <id>extratest</id>
            <properties>
                <skipTests>true</skipTests>
            </properties>
        </profile>

        <!--
        See Maven modules using this profile, e.g. schema or repo-impl-sql-test.
        The profile is NOT active by default and typically configures this:
        - Declares the right plugin (surefire or failsafe) depending on the one normally used in the module.
          Technically, even both can be used, but go with the one used in that POM.
        - Test testing plugin says skipTests=false (that is to run the tests).
        - It defines system property mp.perf.report.prefix=target/PERF (without it CSV goes to stdout).
        - It defines suiteXmlFile=testng-perf.xml - suite file is different then normaly used ones.
          Typically, perf test classes are ONLY in perf suite as they would slow down default builds.
        -->
        <profile>
            <id>perftest</id>
            <properties>
                <skipTests>true</skipTests>
            </properties>
        </profile>
    </profiles>
</project>
