<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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.mulesoft.connectors</groupId>
    <artifactId>mule-selenium-connector</artifactId>
    <version>2.4.2</version>
    <packaging>mule-extension</packaging>
    <name>Selenium Extension</name>

    <parent>
        <groupId>com.mulesoft.connectors</groupId>
        <artifactId>mule4-connectors-parent</artifactId>
        <version>3.0.7</version>
    </parent>

    <properties>
        <!-- Skip formatter, impsort, checkstyle, etc. enforced by the parent. -->
        <skipVerifications>true</skipVerifications>

        <runtimeProduct>MULE_EE</runtimeProduct>
        <munit.failIfNoTests>false</munit.failIfNoTests>

        <connector.maven.plugin.version>3.0.2</connector.maven.plugin.version>
        <configuration.files.s3.folder>${project.artifactId}</configuration.files.s3.folder>
        <configuration.files.vault.secret.engine>connector-credentials</configuration.files.vault.secret.engine>

        <sharepoint.connector.version>3.9.0</sharepoint.connector.version>
        <file.connector.version>1.5.6</file.connector.version>
        <http.connector.version>1.12.0</http.connector.version>

        <selenium.java.version>4.13.0</selenium.java.version>
        <netty.transport.version>4.2.17.Final</netty.transport.version>
        <jackson.version>2.22.1</jackson.version>
        <!-- jackson-annotations follows a distinct no-patch scheme (2.20, 2.21, 2.22 — no 2.22.1),
             so it carries its own property. Keep the two aligned on the same 2.x minor. -->
        <jackson.annotations.version>2.22</jackson.annotations.version>
        <groovy.version>4.0.33</groovy.version>
        <webdrivermanager.version>6.3.4</webdrivermanager.version>
        <aerogear.version>1.0.0</aerogear.version>
        <jakarta.version>2.0.2</jakarta.version>
        <graal.version>21.3.19</graal.version>
        <async.http.client.version>2.16.1</async.http.client.version>
        <!-- Pin Apache HttpClient5/HttpCore5 below the jdk.net.Sockets boundary. WebDriverManager 6.3.4
             transitively pulls httpclient5 5.6 + httpcore5 5.4, which hard-reference jdk/net/Sockets and
             jdk/net/ExtendedSocketOptions in static initializers (DefaultHttpClientConnectionOperator,
             ReflectionUtils). On JDK 25 the Mule plugin classloader filter no longer exports jdk.* packages
             to plugins, so those <clinit>s fail with NoClassDefFoundError: jdk/net/Sockets inside the
             Selenium plugin during WebDriverManager.setup(). 5.5.1/5.3.6 are the last versions with zero
             jdk.net references (the httpclient5 parent-pom couples 5.5.1->httpcore 5.3.6). Re-check this
             coupling on any future WebDriverManager bump. -->
        <httpclient5.version>5.6.4</httpclient5.version>
        <httpcore5.version>5.4.3</httpcore5.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- Align log4j-api with log4j-core/slf4j-impl (2.13.1) on the test classpath. log4j-api 2.24.1
                 arrives transitively via mule-metadata-model-xml -> xmlbeans:5.2.2 and wins Maven nearest-wins
                 over the 2.13.1 from mule-tests-unit -> mule-module-logging; the mismatched LoaderUtil.getClassLoaders()
                 signature then throws NoSuchMethodError at logger init under the Java 25 test command (JDK-independent).
                 Pinning to 2.13.1 keeps api/core aligned. provided scope only — not packaged into the connector. -->
            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-api</artifactId>
                <version>2.16.0</version>
            </dependency>
            <!-- Security fixes: upgrade Jackson and Netty to address critical CVEs -->
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-core</artifactId>
                <version>${jackson.version}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>${jackson.version}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-annotations</artifactId>
                <version>${jackson.annotations.version}</version>
            </dependency>
            <dependency>
                <groupId>io.netty</groupId>
                <artifactId>netty-codec-http</artifactId>
                <version>${netty.transport.version}</version>
            </dependency>
            <dependency>
                <groupId>io.netty</groupId>
                <artifactId>netty-codec-http2</artifactId>
                <version>${netty.transport.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <!-- Inherits version + executions + jacoco argLine + munit-runner/munit-tools/mtf-tools deps from parent.
                     Adds connector-specific FIPS Groovy flags and runtime discovery. -->
                <groupId>com.mulesoft.munit</groupId>
                <artifactId>munit-extensions-maven-plugin</artifactId>
                <configuration>
                    <argLines combine.children="append">
                        <argLine>-Dgroovy.cache.hashing.algorithm=sha256 -Dgroovy.source.cache=false</argLine>
                    </argLines>
                    <environmentVariables>
                        <!-- FIPS 140-3 Compliance: Use SHA-256 for Groovy script caching (MD5 not available in FIPS mode) -->
                        <_JAVA_OPTIONS>-XX:+PrintCommandLineFlags -Dgroovy.cache.hashing.algorithm=sha256 -Dgroovy.source.cache=false ${mtf.javaopts}</_JAVA_OPTIONS>
                    </environmentVariables>
                    <runtimeConfiguration>
                        <discoverRuntimes>
                            <includeSnapshots>false</includeSnapshots>
                            <product>EE</product>
                        </discoverRuntimes>
                    </runtimeConfiguration>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.mule.connectors</groupId>
                        <artifactId>mule-file-connector</artifactId>
                        <version>${file.connector.version}</version>
                        <classifier>mule-plugin</classifier>
                    </dependency>
                    <dependency>
                        <groupId>org.mule.connectors</groupId>
                        <artifactId>mule-http-connector</artifactId>
                        <version>${http.connector.version}</version>
                        <classifier>mule-plugin</classifier>
                    </dependency>
                    <dependency>
                        <groupId>com.mulesoft.connectors</groupId>
                        <artifactId>mule-sharepoint-connector</artifactId>
                        <version>${sharepoint.connector.version}</version>
                        <classifier>mule-plugin</classifier>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <!-- Override parent's connector-analyze: this connector bundles dependencies that are exercised by
                     user-supplied Groovy/JS scripts (Selenium WebDriver, async HTTP, Netty, GraalVM JS, OTP, mail,
                     webdrivermanager) and thus appear unused to static analysis. -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>connector-analyze</id>
                        <configuration>
                            <ignoredUnusedDeclaredDependencies>
                                <ignoredUnusedDeclaredDependency>*</ignoredUnusedDeclaredDependency>
                            </ignoredUnusedDeclaredDependencies>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.mulesoft.connectors.maven</groupId>
                <artifactId>connector-maven-plugin</artifactId>
                <version>${connector.maven.plugin.version}</version>
                <executions>
                    <execution>
                        <id>get-configuration-files</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>get-configuration-files</goal>
                        </goals>
                        <configuration>
                            <folder>${configuration.files.s3.folder}</folder>
                            <vaultBucket>${configuration.files.vault.secret.engine}</vaultBucket>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <!-- selenium-java pinned at 4.13.0 — last release compilable with Java 8 (still in @JavaVersionSupport). -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>${selenium.java.version}</version>
            <scope>compile</scope>
            <exclusions>
                <exclusion>
                    <groupId>io.netty</groupId>
                    <artifactId>netty-transport-native-epoll</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>io.netty</groupId>
                    <artifactId>netty-transport-native-kqueue</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.yaml</groupId>
            <artifactId>snakeyaml</artifactId>
            <version>2.6</version>
        </dependency>
        <dependency>
            <groupId>org.asynchttpclient</groupId>
            <artifactId>async-http-client</artifactId>
            <version>${async.http.client.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>io.netty</groupId>
                    <artifactId>netty-codec-http</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>io.netty</groupId>
                    <artifactId>netty-handler</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>io.netty</groupId>
                    <artifactId>netty-transport-native-epoll</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>io.netty</groupId>
                    <artifactId>netty-transport-native-kqueue</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>io.netty</groupId>
                    <artifactId>netty-handler-proxy</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>io.netty</groupId>
                    <artifactId>netty-codec-socks</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.22.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.20.0</version>
        </dependency>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-codec-http</artifactId>
            <version>${netty.transport.version}</version>
        </dependency>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-codec-socks</artifactId>
            <version>${netty.transport.version}</version>
        </dependency>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-handler-proxy</artifactId>
            <version>${netty.transport.version}</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
            <scope>test</scope>
        </dependency>
        <!-- Surefire uses JUnit Platform (via transitive Groovy test stack); Vintage runs JUnit 4 tests. -->
        <dependency>
            <groupId>org.junit.vintage</groupId>
            <artifactId>junit-vintage-engine</artifactId>
            <version>5.14.4</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>33.6.0-jre</version>
        </dependency>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-handler</artifactId>
            <version>${netty.transport.version}</version>
        </dependency>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-transport-native-epoll</artifactId>
            <version>${netty.transport.version}</version>
        </dependency>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-transport-native-kqueue</artifactId>
            <version>${netty.transport.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.groovy</groupId>
            <artifactId>groovy-all</artifactId>
            <version>${groovy.version}</version>
            <type>pom</type>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.groovy</groupId>
                    <artifactId>groovy-ant</artifactId>
                </exclusion>
                <!-- groovy-all bundles groovy-test-junit5, which drags junit-platform-launcher onto the test
                     classpath (1.11.3 at groovy 4.0.24, 1.13.3 at 4.0.32). junit-vintage-engine 5.14.4 supplies
                     junit-platform-engine/-commons 1.14.4; Surefire 2.22.2 prefers the project-classpath launcher,
                     and launcher 1.13.3 against engine 1.14.4 discovers zero test engines -> "Tests run: 0" ->
                     0% coverage. This connector uses Groovy only as a runtime scripting engine (GroovyShell), never
                     its JUnit5 test integration, so excluding groovy-test-junit5 keeps the groovy version from
                     perturbing test discovery. -->
                <exclusion>
                    <groupId>org.apache.groovy</groupId>
                    <artifactId>groovy-test-junit5</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>io.github.bonigarcia</groupId>
            <artifactId>webdrivermanager</artifactId>
            <version>${webdrivermanager.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>com.github.docker-java</groupId>
                    <artifactId>docker-java-transport-httpclient5</artifactId>
                </exclusion>
                <!-- JDK 25 gap fix: drop WebDriverManager's httpclient5 5.6 / httpcore5 5.4 (they reference
                     jdk/net/Sockets, invisible in the isolated plugin classloader on JDK 25). The matched
                     pair 5.5.1/5.3.6 is supplied as direct dependencies just below. -->
                <exclusion>
                    <groupId>org.apache.httpcomponents.client5</groupId>
                    <artifactId>httpclient5</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.httpcomponents.core5</groupId>
                    <artifactId>httpcore5</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.httpcomponents.core5</groupId>
                    <artifactId>httpcore5-h2</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- JDK 25 gap fix (see the httpclient5.version property comment). WebDriverManager's transitive
             httpclient5 5.6 / httpcore5 5.4 are excluded above, and the matched pair 5.5.1/5.3.6 is declared
             here as DIRECT dependencies. dependencyManagement is deliberately NOT used: a mule-plugin's
             <dependencyManagement> is not inherited by consumers (OneDrive/SharePoint) when the Selenium plugin
             is resolved transitively into their isolated classloader, so a DM-only pin is silently ignored there.
             A direct dependency is the shortest path (depth 1) to httpclient5, so Maven nearest-wins pins
             5.5.1/5.3.6 in this build and everywhere the plugin is consumed, keeping the jdk/net/Sockets
             <clinit> off the JDK 25 code path. -->
        <dependency>
            <groupId>org.apache.httpcomponents.client5</groupId>
            <artifactId>httpclient5</artifactId>
            <version>${httpclient5.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents.core5</groupId>
            <artifactId>httpcore5</artifactId>
            <version>${httpcore5.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents.core5</groupId>
            <artifactId>httpcore5-h2</artifactId>
            <version>${httpcore5.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.aerogear</groupId>
            <artifactId>aerogear-otp-java</artifactId>
            <version>${aerogear.version}</version>
        </dependency>
        <dependency>
            <groupId>com.sun.mail</groupId>
            <artifactId>jakarta.mail</artifactId>
            <version>${jakarta.version}</version>
        </dependency>
        <dependency>
            <groupId>org.graalvm.js</groupId>
            <artifactId>js</artifactId>
            <version>${graal.version}</version>
        </dependency>
        <dependency>
            <groupId>org.graalvm.js</groupId>
            <artifactId>js-scriptengine</artifactId>
            <version>${graal.version}</version>
        </dependency>
    </dependencies>

    <repositories>
        <repository>
            <id>mule-releases</id>
            <name>Nexus Public Releases</name>
            <url>https://repository-master.mulesoft.org/nexus/content/repositories/releases/</url>
        </repository>
    </repositories>
</project>
