<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.16</version>
    <relativePath />
  </parent>
  <artifactId>gitlab-plugin</artifactId>
  <version>1.5.19</version>
  <name>GitLab Plugin</name>
  <url>https://github.com/jenkinsci/gitlab-plugin/</url>
  <packaging>hpi</packaging>

  <properties>
    <revision>1.5.18</revision>
    <changelist>-SNAPSHOT</changelist>
    <java.level>8</java.level>
    <jenkins.version>2.222.4</jenkins.version>
    <spotbugs.failOnError>false</spotbugs.failOnError>
    <configuration-as-code-plugin.version>1.46</configuration-as-code-plugin.version>
    <hpi.compatibleSinceVersion>1.4.0</hpi.compatibleSinceVersion>
    <jackson.version>2.12.1</jackson.version>
    <jenkins-test-harness.version>2.71</jenkins-test-harness.version>
  </properties>


  <licenses>
    <license>
      <name>GPL v2.0 License</name>
      <url>http://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html</url>
    </license>
  </licenses>

  <developers>
    <developer>
      <id>markyjackson-taulia</id>
      <name>Marky Jackson</name>
      <email>marky.r.jackson@gmail.com</email>
    </developer>
  </developers>

  <distributionManagement>
    <repository>
      <id>maven.jenkins-ci.org</id>
      <name>jenkinsci-releases</name>
      <url>https://repo.jenkins-ci.org/releases</url>
    </repository>
    <snapshotRepository>
      <id>maven.jenkins-ci.org</id>
      <name>jenkinsci-snapshots</name>
      <url>https://repo.jenkins-ci.org/snapshots</url>
    </snapshotRepository>
  </distributionManagement>

  <scm>
    <connection>scm:git:ssh://github.com:jenkinsci/gitlab-plugin.git</connection>
    <developerConnection>scm:git:git@github.com:jenkinsci/gitlab-plugin.git</developerConnection>
    <url>https://github.com/jenkinsci/gitlab-plugin</url>
    <tag>gitlab-plugin-1.5.19</tag>
  </scm>
  <!-- get every artifact through repo.jenkins-ci.org, which proxies all the artifacts that we need -->
  <repositories>
    <repository>
      <id>repo.jenkins-ci.org-public</id>
      <url>https://repo.jenkins-ci.org/public/</url>
    </repository>
    <repository>
      <id>repo.jenkins-ci.org-releases</id>
      <url>https://repo.jenkins-ci.org/releases/</url>
    </repository>
    <repository>
      <id>jgit-repository</id>
      <name>Eclipse JGit Repository</name>
      <url>https://download.eclipse.org/jgit/maven</url>
    </repository>
  </repositories>

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

  <dependencies>
    <!-- Jenkins dependencies -->
    <dependency>
      <groupId>org.jenkins-ci.plugins</groupId>
      <artifactId>git</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.plugins</groupId>
      <artifactId>git-client</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.plugins</groupId>
      <artifactId>junit</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.plugins</groupId>
      <artifactId>structs</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.plugins</groupId>
      <artifactId>scm-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.plugins.workflow</groupId>
      <artifactId>workflow-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.plugins</groupId>
      <artifactId>script-security</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.plugins.workflow</groupId>
      <artifactId>workflow-step-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.plugins.workflow</groupId>
      <artifactId>workflow-durable-task-step</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.plugins.workflow</groupId>
      <artifactId>workflow-cps-global-lib</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.plugins.workflow</groupId>
      <artifactId>workflow-support</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.plugins.workflow</groupId>
      <artifactId>workflow-scm-step</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.plugins.workflow</groupId>
      <artifactId>workflow-job</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.plugins</groupId>
      <artifactId>credentials</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.plugins</groupId>
      <artifactId>plain-credentials</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.plugins</groupId>
      <artifactId>ssh-credentials</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci</groupId>
      <artifactId>symbol-annotation</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.plugins</groupId>
      <artifactId>matrix-project</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.plugins</groupId>
      <artifactId>display-url-api</artifactId>
    </dependency>


    <!-- REST client dependencies -->
    <dependency>
      <groupId>org.jboss.spec.javax.ws.rs</groupId>
      <artifactId>jboss-jaxrs-api_2.0_spec</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>resteasy-client</artifactId>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.jaxrs</groupId>
      <artifactId>jackson-jaxrs-json-provider</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.plugins</groupId>
      <artifactId>jackson2-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.plugins</groupId>
      <artifactId>apache-httpcomponents-client-4-api</artifactId>
    </dependency>

    <!-- util dependencies -->
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
    </dependency>
    <dependency>
      <groupId>net.karneim</groupId>
      <artifactId>pojobuilder</artifactId>
      <scope>provided</scope>
    </dependency>

    <!-- test dependencies -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.jenkins</groupId>
      <artifactId>configuration-as-code</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.jenkins.configuration-as-code</groupId>
      <artifactId>test-harness</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.powermock</groupId>
      <artifactId>powermock-api-mockito2</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.powermock</groupId>
      <artifactId>powermock-module-junit4</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mock-server</groupId>
      <artifactId>mockserver-netty</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.bouncycastle</groupId>
          <artifactId>bcmail-jdk15on</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.bouncycastle</groupId>
          <artifactId>bcprov-jdk15on</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.bouncycastle</groupId>
          <artifactId>bcpkix-jdk15on</artifactId>
        </exclusion>
        <exclusion>
          <groupId>javax.servlet</groupId>
          <artifactId>javax.servlet-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.postgresql</groupId>
      <artifactId>postgresql</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.plugins</groupId>
      <artifactId>matrix-auth</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.plugins.workflow</groupId>
      <artifactId>workflow-cps</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.plugins.workflow</groupId>
      <artifactId>workflow-basic-steps</artifactId>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <dependencyManagement>
    <dependencies>


      <dependency>
        <!-- Pick up common dependencies for the selected LTS line: https://github.com/jenkinsci/bom#usage -->
        <groupId>io.jenkins.tools.bom</groupId>
        <artifactId>bom-2.222.x</artifactId>
        <version>23</version>
        <scope>import</scope>
        <type>pom</type>
      </dependency>

      <!--3rd party-->
      <dependency>
        <groupId>org.postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <version>9.4.1208</version>
        <scope>test</scope>
      </dependency>
      <dependency>
      <groupId>org.mock-server</groupId>
      <artifactId>mockserver-netty</artifactId>
      <version>3.10.2</version>
      <scope>test</scope>
      </dependency>

      <dependency>
        <groupId>org.jboss.spec.javax.ws.rs</groupId>
        <artifactId>jboss-jaxrs-api_2.0_spec</artifactId>
        <version>1.0.0.Final</version>
      </dependency>
      <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-client</artifactId>
        <version>3.0.16.Final</version>
      </dependency>
      <dependency>
        <groupId>com.fasterxml.jackson.jaxrs</groupId>
        <artifactId>jackson-jaxrs-json-provider</artifactId>
        <version>${jackson.version}</version>
      </dependency>


      <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>18.0</version>
      </dependency>
      <dependency>
        <groupId>net.karneim</groupId>
        <artifactId>pojobuilder</artifactId>
        <version>3.4.0</version>
      </dependency>
      <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.11</version>
      </dependency>
    </dependencies>

  </dependencyManagement>


  <profiles>
    <profile>
      <id>integration-test</id>
      <properties>
        <gitlab.version>8.17.4</gitlab.version>
        <postgres.version>9.5-1</postgres.version>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <skip>true</skip>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>2.16</version>
            <executions>
              <execution>
                <goals>
                  <goal>integration-test</goal>
                  <goal>verify</goal>
                </goals>
                <configuration>
                  <systemProperties>
                    <property>
                      <name>gitlab.http.port</name>
                      <value>${gitlab.http.port}</value>
                    </property>
                    <property>
                      <name>postgres.port</name>
                      <value>${postgres.port}</value>
                    </property>
                  </systemProperties>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>port-allocator-maven-plugin</artifactId>
            <version>1.2</version>
            <executions>
              <execution>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>allocate-ports</goal>
                </goals>
                <configuration>
                  <ports>
                    <port>
                      <name>gitlab.http.port</name>
                    </port>
                    <port>
                      <name>gitlab.ssh.port</name>
                    </port>
                    <port>
                      <name>postgres.port</name>
                    </port>
                  </ports>
                </configuration>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>io.fabric8</groupId>
            <artifactId>docker-maven-plugin</artifactId>
            <version>0.14.2</version>
            <configuration>
              <verbose>true</verbose>
              <images>
                <image>
                  <name>sameersbn/postgresql:${postgres.version}</name>
                  <alias>it-gitlab-postgres</alias>
                  <run>
                    <namingStrategy>alias</namingStrategy>
                    <env>
                      <DB_NAME>gitlabhq_production</DB_NAME>
                      <DB_USER>gitlab</DB_USER>
                      <DB_PASS>password</DB_PASS>
                      <DB_EXTENSION>pg_trgm</DB_EXTENSION>
                    </env>
                    <ports>
                      <port>${postgres.port}:5432</port>
                    </ports>
                  </run>
                </image>
                <image>
                  <name>sameersbn/redis</name>
                  <alias>it-gitlab-redis</alias>
                  <run>
                    <namingStrategy>alias</namingStrategy>
                  </run>
                </image>
                <image>
                  <name>sameersbn/gitlab:${gitlab.version}</name>
                  <alias>it-gitlab-gitlab</alias>
                  <run>
                    <namingStrategy>alias</namingStrategy>
                    <links>
                      <link>it-gitlab-postgres:postgresql</link>
                      <link>it-gitlab-redis:redisio</link>
                    </links>
                    <ports>
                      <port>${gitlab.http.port}:80</port>
                      <port>${gitlab.ssh.port}:22</port>
                    </ports>
                    <env>
                      <DEBUG>false</DEBUG>
                      <TZ>Asia/Kolkata</TZ>
                      <GITLAB_TIMEZONE>Kolkata</GITLAB_TIMEZONE>
                      <GITLAB_PORT>${gitlab.http.port}</GITLAB_PORT>
                      <GITLAB_SSH_PORT>${gitlab.ssh.port}</GITLAB_SSH_PORT>
                      <GITLAB_SECRETS_DB_KEY_BASE>long-and-random-alpha-numeric-string</GITLAB_SECRETS_DB_KEY_BASE>
                      <GITLAB_SECRETS_SECRET_KEY_BASE>long-and-random-alphanumeric-string</GITLAB_SECRETS_SECRET_KEY_BASE>
                      <GITLAB_SECRETS_OTP_KEY_BASE>long-and-random-alpha-numeric-string</GITLAB_SECRETS_OTP_KEY_BASE>
                      <GITLAB_HOST>172.17.0.1</GITLAB_HOST>
                    </env>
                    <wait>
                      <http>
                        <url>http://localhost:${gitlab.http.port}/</url>
                      </http>
                      <time>120000</time>
                    </wait>
                  </run>
                </image>
              </images>
            </configuration>
            <executions>
              <execution>
                <id>start</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>build</goal>
                  <goal>start</goal>
                </goals>
              </execution>
              <execution>
                <id>stop</id>
                <phase>post-integration-test</phase>
                <goals>
                  <goal>stop</goal>
                  <goal>remove</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>3.0.0</version>
            <executions>
              <execution>
                <id>add-source</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>add-source</goal>
                </goals>
                <configuration>
                  <sources>
                    <source>${basedir}/target/generated-sources</source>
                  </sources>
                </configuration>
              </execution>
              <execution>
                <id>add-test-source</id>
                <phase>generate-test-sources</phase>
                <goals>
                  <goal>add-test-source</goal>
                </goals>
                <configuration>
                  <sources>
                    <source>${basedir}/target/generated-test-sources</source>
                  </sources>
                </configuration>
              </execution>
            </executions>
          </plugin>

        </plugins>
      </build>
    </profile>
  </profiles>
</project>
