<?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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.jenkins-ci.plugins</groupId>
        <artifactId>plugin</artifactId>
        <version>4.42</version>
        <relativePath />
    </parent>
    <groupId>io.jenkins.plugins</groupId>
    <artifactId>atlassian-bitbucket-server-integration</artifactId>
    <version>4.1.0</version>
    <packaging>hpi</packaging>
    <properties>
        <!-- This property can most likely be removed when our minimum Jenkins version is greater than 2.456 -->
        <asm.version>9.7</asm.version>
        <bitbucket.version>6.10.15</bitbucket.version>
        <cloverVersion>4.3.1</cloverVersion>
        <disableTestInjection>true</disableTestInjection>
        <hamcrest.version>2.2</hamcrest.version>
        <jackson.version>2.15.3</jackson.version>
        <!-- When updating the Jenkins version, also update io.jenkins.tools.bom dependency management and the README -->
        <jenkins.version>2.401.3</jenkins.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <net.oauth.version>20100527</net.oauth.version>
        <!-- exclude the upgrade tests by default, as they interact with external resources and should not be run frequently -->
        <surefireTestExclusions>upgrade/**</surefireTestExclusions>
    </properties>
    <name>Bitbucket Server Integration</name>
    <description>This Jenkins plugin streamlines configuring Jenkins jobs to clone/fetch from Bitbucket Server.
    </description>
    <url>https://github.com/jenkinsci/atlassian-bitbucket-server-integration-plugin</url>

    <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>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.jenkins.tools.bom</groupId>
                <artifactId>bom-2.401.x</artifactId>
                <version>2661.vb_b_60650f6d97</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <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.squareup.okhttp3</groupId>
            <artifactId>okhttp</artifactId>
            <version>3.14.9</version>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.15</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.11.0</version>
            <scope>provided
            </scope> <!-- Should really be test scope but that scope does not work due to transitive dependencies -->
        </dependency>
        <dependency>
            <groupId>net.i2p.crypto</groupId>
            <artifactId>eddsa</artifactId>
            <version>0.3.0</version>
        </dependency>
        <dependency>
            <groupId>net.oauth.core</groupId>
            <artifactId>oauth</artifactId>
            <version>${net.oauth.version}</version>
        </dependency>
        <dependency>
            <groupId>net.oauth.core</groupId>
            <artifactId>oauth-provider</artifactId>
            <version>${net.oauth.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.13.0</version>
            <exclusions>
                <exclusion>
                    <!-- commons-text comes in via the jenkins:checks-api at a more modern version, exclude this one -->
                    <groupId>org.apache.commons</groupId>
                    <artifactId>commons-text</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
            <version>4.4.16</version>
        </dependency>
        <dependency>
            <groupId>org.jenkins-ci.modules</groupId>
            <artifactId>instance-identity</artifactId>
            <version>142.v04572ca_5b_265</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.jenkins-ci.plugins</groupId>
            <artifactId>apache-httpcomponents-client-4-api</artifactId>
            <!--<version>managed by bom</version>-->
        </dependency>
        <dependency>
            <groupId>org.jenkins-ci.plugins</groupId>
            <artifactId>branch-api</artifactId>
            <!--<version>managed by bom</version>-->
        </dependency>
        <dependency>
            <groupId>org.jenkins-ci.plugins</groupId>
            <artifactId>cloudbees-folder</artifactId>
            <!--<version>managed by bom</version>-->
        </dependency>
        <dependency>
            <groupId>org.jenkins-ci.plugins</groupId>
            <artifactId>credentials</artifactId>
            <!--<version>managed by bom</version>-->
            <exclusions>
                <exclusion>
                    <groupId>org.jenkins-ci.plugins</groupId>
                    <artifactId>structs</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.jenkins-ci.plugins</groupId>
            <artifactId>git</artifactId>
            <!--<version>managed by bom</version>-->
            <exclusions>
                <exclusion>
                    <groupId>org.jenkins-ci.plugins</groupId>
                    <artifactId>junit</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.jenkins-ci.plugins</groupId>
            <artifactId>junit</artifactId>
            <!--<version>managed by bom</version>-->
        </dependency>
        <dependency>
            <groupId>org.jenkins-ci.plugins</groupId>
            <artifactId>mailer</artifactId>
            <!--<version>managed by bom</version>-->
        </dependency>
        <dependency>
            <groupId>org.jenkins-ci.plugins</groupId>
            <artifactId>pipeline-build-step</artifactId>
            <!--<version>managed by bom</version>-->
        </dependency>
        <dependency>
            <groupId>org.jenkins-ci.plugins</groupId>
            <artifactId>pipeline-input-step</artifactId>
            <!--<version>managed by bom</version>-->
        </dependency>
        <dependency>
            <groupId>org.jenkins-ci.plugins</groupId>
            <artifactId>pipeline-milestone-step</artifactId>
            <version>1.3.2</version>
        </dependency>
        <dependency>
            <groupId>org.jenkinsci.plugins</groupId>
            <artifactId>pipeline-model-definition</artifactId>
            <!--<version>managed by bom</version>-->
        </dependency>
        <dependency>
            <groupId>org.jenkins-ci.plugins</groupId>
            <artifactId>pipeline-stage-step</artifactId>
            <!--<version>managed by bom</version>-->
        </dependency>
        <dependency>
            <groupId>org.jenkins-ci.plugins</groupId>
            <artifactId>plain-credentials</artifactId>
            <!--<version>managed by bom</version>-->
        </dependency>
        <dependency>
            <groupId>org.jenkins-ci.plugins</groupId>
            <artifactId>scm-api</artifactId>
            <!--<version>managed by bom</version>-->
        </dependency>
        <dependency>
            <groupId>org.jenkins-ci.plugins</groupId>
            <artifactId>script-security</artifactId>
            <!--<version>managed by bom</version>-->
            <exclusions>
                <exclusion>
                    <groupId>org.jenkins-ci.plugins</groupId>
                    <artifactId>junit</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.jenkins-ci.plugins.workflow</groupId>
            <artifactId>workflow-api</artifactId>
            <!--<version>managed by bom</version>-->
        </dependency>
        <dependency>
            <groupId>org.jenkins-ci.plugins.workflow</groupId>
            <artifactId>workflow-basic-steps</artifactId>
            <!--<version>managed by bom</version>-->
        </dependency>
        <dependency>
            <groupId>org.jenkins-ci.plugins.workflow</groupId>
            <artifactId>workflow-cps</artifactId>
            <!--<version>managed by bom</version>-->
        </dependency>
        <dependency>
            <groupId>org.jenkins-ci.plugins.workflow</groupId>
            <artifactId>workflow-job</artifactId>
            <!--<version>managed by bom</version>-->
        </dependency>
        <dependency>
            <groupId>org.jenkins-ci.plugins.workflow</groupId>
            <artifactId>workflow-multibranch</artifactId>
            <!--<version>managed by bom</version>-->
        </dependency>
        <dependency>
            <groupId>org.jenkins-ci.plugins.workflow</groupId>
            <artifactId>workflow-support</artifactId>
            <!--<version>managed by bom</version>-->
        </dependency>
        <dependency>
            <groupId>com.github.spotbugs</groupId>
            <artifactId>spotbugs-annotations</artifactId>
            <!--<version>managed by bom</version>-->
        </dependency>
        <dependency>
            <groupId>org.jfree</groupId>
            <artifactId>jcommon</artifactId>
            <version>1.0.24</version>
        </dependency>
        <!--        Test dependencies -->
        <dependency>
            <groupId>org.jenkins-ci.main</groupId>
            <artifactId>jenkins-test-harness</artifactId>
            <version>1784.v83a_b_3ce99392</version>
            <scope>test</scope>
        </dependency>
        <!--to mock Bitbucket Server-->
        <dependency>
            <groupId>com.github.tomakehurst</groupId>
            <artifactId>wiremock-jre8-standalone</artifactId>
            <version>2.35.1</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.mortbay.jetty</groupId>
                    <artifactId>jetty</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.google.guava</groupId>
                    <artifactId>guava</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.httpcomponents</groupId>
                    <artifactId>httpclient</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xmlunit</groupId>
                    <artifactId>xmlunit</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.jayway.jsonpath</groupId>
                    <artifactId>json-path</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>net.sf.jopt-simple</groupId>
                    <artifactId>jopt-simple</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.spotify</groupId>
            <artifactId>hamcrest-optional</artifactId>
            <version>1.1.5</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <version>4.4.0</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.commons</groupId>
                    <artifactId>commons-lang3</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.xml.bind</groupId>
                    <artifactId>jaxb-osgi</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hamcrest</groupId>
                    <artifactId>hamcrest</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>net.lingala.zip4j</groupId>
            <artifactId>zip4j</artifactId>
            <version>2.11.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-core</artifactId>
            <version>${hamcrest.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-library</artifactId>
            <version>${hamcrest.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>2.21.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.reflections</groupId>
            <artifactId>reflections</artifactId>
            <version>0.9.12</version>
            <scope>test</scope>
        </dependency>
        <!-- This dependency can most likely be removed when our minimum Jenkins version is greater than 2.456 -->
        <dependency>
            <groupId>org.ow2.asm</groupId>
            <artifactId>asm-commons</artifactId>
            <scope>test</scope>
            <version>${asm.version}</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <configuration>
                    <!-- The jacoco integration is annoying when doing code reviews on github, we have the clover profile for
                    coverage, thus disable the jacoco coverage -->
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jenkins-ci.tools</groupId>
                <artifactId>maven-hpi-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <consoleForceReload>false</consoleForceReload>
                    <disabledTestInjection>${disableTestInjection}</disabledTestInjection>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <!-- Surefire is used to run the unit tests, and Failsafe is used to run the integration tests. So we
                         exclude integration tests here. -->
                    <excludes>
                        <exclude>it/**/*.java</exclude>
                        <exclude>${surefireTestExclusions}</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>3.0.0</version>
                <configuration>
                    <configLocation>checkstyle.xml</configLocation>
                    <encoding>UTF-8</encoding>
                    <includeTestSourceDirectory>true</includeTestSourceDirectory>
                    <consoleOutput>true</consoleOutput>
                    <failsOnError>true</failsOnError>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>com.puppycrawl.tools</groupId>
                        <artifactId>checkstyle</artifactId>
                        <version>8.20</version>
                    </dependency>
                    <dependency>
                        <groupId>com.atlassian.bitbucket.server</groupId>
                        <artifactId>bitbucket-checkstyle</artifactId>
                        <version>2.0.1</version>
                        <exclusions>
                            <exclusion>
                                <groupId>checkstyle</groupId>
                                <artifactId>checkstyle</artifactId>
                            </exclusion>
                        </exclusions>
                    </dependency>
                    <dependency>
                        <groupId>com.atlassian</groupId>
                        <artifactId>checkstyle-custom-checks</artifactId>
                        <version>1.0.0</version>
                        <exclusions>
                            <exclusion>
                                <groupId>checkstyle</groupId>
                                <artifactId>checkstyle</artifactId>
                            </exclusion>
                        </exclusions>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <!-- The config for BitbucketSCMStep is the same as for BitbucketSCM so this step copies it over-->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.8</version>
                <executions>
                    <execution>
                        <id>Create BitbucketSCMStep dir</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <echo>Copying across symlink</echo>
                                <copy todir="${basedir}/src/main/resources/com/atlassian/bitbucket/jenkins/internal/scm/BitbucketSCMStep">
                                    <fileset dir="${basedir}/src/main/resources/com/atlassian/bitbucket/jenkins/internal/scm/BitbucketSCM" includes="**" />
                                </copy>
                            </tasks>
                        </configuration>
                    </execution>
                    <execution>
                        <id>Create artifacts dir</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <echo>Creating artifacts dir</echo>
                                <mkdir dir="${basedir}/target/artifacts" />
                            </tasks>
                        </configuration>
                    </execution>
                    <execution>
                        <id>Copy Bitbucket logs to artifacts dir</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <echo>Publishing Bitbucket logs to the artifacts directory</echo>
                                <copy todir="${basedir}/target/artifacts" failonerror="false">
                                    <fileset dir="${basedir}/target/bitbucket/home/log" includes="**" />
                                </copy>
                            </tasks>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <!--
            Run with mvn verify -Pclover  -Dmaven.test.failure.ignore=true and then view the html clover report in
            target/site/clover
            -->
            <id>clover</id>
            <properties>
                <disableTestInjection>true</disableTestInjection>
                <spotbugs.skip>true</spotbugs.skip>
                <jenkins.security.ClassFilterImpl.SUPPRESS_ALL>true</jenkins.security.ClassFilterImpl.SUPPRESS_ALL>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.openclover</groupId>
                        <artifactId>clover-maven-plugin</artifactId>
                        <version>${cloverVersion}</version>
                        <configuration>
                            <excludes>
                                <exclude>hudson.model/**/*</exclude>
                                <exclude>it/**/*</exclude>
                            </excludes>
                        </configuration>
                        <executions>
                            <execution>
                                <id>clover</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>instrument</goal>
                                    <goal>check</goal>
                                    <goal>clover</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            <reporting>
                <plugins>
                    <plugin>
                        <groupId>org.openclover</groupId>
                        <artifactId>clover-maven-plugin</artifactId>
                        <version>${cloverVersion}</version>
                    </plugin>
                </plugins>
            </reporting>
        </profile>
        <profile>
            <!-- The Injected Tests are causing issues with Mockito with Java 11 on this version of the plugin, so they
            are disabled by default. For full test coverage, this should profile should be run as well.-->
            <id>injectedTests</id>
            <properties>
                <disableTestInjection>false</disableTestInjection>
                <surefireTestExclusions>com/**/*.java</surefireTestExclusions>
            </properties>
        </profile>
        <profile>
            <id>it</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <configuration>
                            <skipTests>false</skipTests>
                            <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>com.atlassian.maven.plugins</groupId>
                        <artifactId>bitbucket-maven-plugin</artifactId>
                        <version>9.0.1</version>
                        <extensions>true</extensions>
                        <configuration>
                            <products>
                                <product>
                                    <id>bitbucket</id>
                                    <instanceId>bitbucket</instanceId>
                                    <version>${bitbucket.version}</version>
                                    <productDataVersion>${bitbucket.version}</productDataVersion>
                                    <jvm>${bitbucket.jvm}</jvm>
                                </product>
                            </products>
                        </configuration>
                        <executions>
                            <execution>
                                <id>pre-its</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>integration-test</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>upgradeTest</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <excludes>
                                <exclude>it/**</exclude>
                            </excludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>versionUpdate</id>
            <dependencies>
                <dependency>
                    <groupId>org.jenkins-ci.main</groupId>
                    <artifactId>jenkins-core</artifactId>
                    <version>${jenkins.version}</version>
                </dependency>
                <dependency>
                    <groupId>com.atlassian.bitbucket.server</groupId>
                    <artifactId>bitbucket-parent</artifactId>
                    <version>${bitbucket.version}</version>
                </dependency>
            </dependencies>
        </profile>
    </profiles>

    <scm>
        <connection>scm:git:git://github.com/jenkinsci/atlassian-bitbucket-server-integration-plugin.git</connection>
        <developerConnection>scm:git:git@github.com:jenkinsci/atlassian-bitbucket-server-integration-plugin.git
        </developerConnection>
        <url>http://github.com/jenkinsci/atlassian-bitbucket-server-integration-plugin</url>
        <tag>atlassian-bitbucket-server-integration-4.1.0</tag>
    </scm>

    <repositories>
        <repository>
            <id>repo.jenkins-ci.org</id>
            <url>https://repo.jenkins-ci.org/public/</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>repo.jenkins-ci.org</id>
            <url>https://repo.jenkins-ci.org/public/</url>
        </pluginRepository>
    </pluginRepositories>

</project>
