<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>2.3</version>
  </parent>

  <properties>
    <jenkins.version>1.609.3</jenkins.version>
    <hpi-plugin.version>1.115</hpi-plugin.version>
    <jenkins-test-harness.version>${jenkins.version}</jenkins-test-harness.version>
    <findbugs.failOnError>false</findbugs.failOnError>
  </properties>

  <artifactId>gitlab-plugin</artifactId>
  <version>1.3.0</version>
  <name>GitLab Plugin</name>
  <url>https://wiki.jenkins-ci.org/display/JENKINS/GitLab+Plugin</url>
  <packaging>hpi</packaging>

  <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>coderhugo</id>
      <name>Robin Müller</name>
      <email>coderhugo@googlemail.com</email>
    </developer>
    <developer>
      <id>owenmehegan</id>
      <name>Owen Mehegan</name>
      <email>owen@nerdnetworks.org</email>
    </developer>
    <developer>
      <id>omorillo</id>
      <name>Oscar Salvador Morillo Victoria</name>
      <email>omorillovictoria@googlemail.com</email>
    </developer>
  </developers>

  <distributionManagement>
    <repository>
      <id>maven.jenkins-ci.org</id>
      <name>jenkinsci-releases</name>
      <url>http://repo.jenkins-ci.org/releases</url>
    </repository>
    <snapshotRepository>
      <id>maven.jenkins-ci.org</id>
      <name>jenkinsci-snapshots</name>
      <url>http://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.3.0</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</id>
      <url>http://repo.jenkins-ci.org/public/</url>
    </repository>
    <repository>
      <id>jgit-repository</id>
      <name>Eclipse JGit Repository</name>
      <url>http://download.eclipse.org/jgit/maven</url>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>repo.jenkins-ci.org</id>
      <url>http://repo.jenkins-ci.org/public/</url>
    </pluginRepository>
  </pluginRepositories>

  <build>
    <directory>${project.basedir}/target</directory>
    <outputDirectory>${project.build.directory}/classes</outputDirectory>
    <finalName>${project.artifactId}-${project.version}</finalName>
    <testOutputDirectory>${project.build.directory}/test-classes</testOutputDirectory>
    <sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
    <scriptSourceDirectory>${project.basedir}/src/main/scripts</scriptSourceDirectory>
    <testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory>
    <resources>
      <resource>
        <directory>${project.basedir}/src/main/resources</directory>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <directory>${project.basedir}/src/test/resources</directory>
      </testResource>
    </testResources>
    <pluginManagement>
      <!-- NOTE: These plugins will be removed from future versions of the super POM -->
      <!-- They are kept for the moment as they are very unlikely to conflict with lifecycle mappings (MNG-4453) -->
      <plugins>
        <plugin>
          <artifactId>maven-antrun-plugin</artifactId>
          <version>1.3</version>
        </plugin>
        <plugin>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>2.2-beta-5</version>
        </plugin>
        <plugin>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>2.8</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.5.1</version>
          <dependencies>
            <dependency>
              <groupId>org.apache.maven.scm</groupId>
              <artifactId>maven-scm-provider-gitexe</artifactId>
              <version>1.9.2</version>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.5.1</version>
        </plugin>
	<plugin>
	  <groupId>org.apache.maven.plugins</groupId>
	  <artifactId>maven-surefire-plugin</artifactId>
	  <version>2.18.1</version>
	  <configuration>
	    <argLine>${argLine} -Xmx1024m -XX:MaxPermSize=512m</argLine>
	  </configuration>
	</plugin>
	<plugin>
	  <groupId>org.jenkins-ci.tools</groupId>
	  <artifactId>maven-hpi-plugin</artifactId>
	  <extensions>true</extensions>
	  <configuration>
	    <compatibleSinceVersion>1.2.0</compatibleSinceVersion>
	  </configuration>
	</plugin>
      </plugins>
    </pluginManagement>
  </build>

  <dependencies>
    <!-- Jenkins dependencies -->
    <dependency>
      <groupId>org.jenkins-ci.plugins</groupId>
      <artifactId>git</artifactId>
      <version>2.4.1</version>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.plugins</groupId>
      <artifactId>git-client</artifactId>
      <version>1.19.0</version>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.plugins.workflow</groupId>
      <artifactId>workflow-step-api</artifactId>
      <version>1.15</version>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.plugins</groupId>
      <artifactId>credentials</artifactId>
      <version>2.1.0</version>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.plugins</groupId>
      <artifactId>plain-credentials</artifactId>
      <version>1.1</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jgit</groupId>
      <artifactId>org.eclipse.jgit</artifactId>
      <version>3.5.2.201411120430-r</version>
    </dependency>

    <!-- REST client dependencies -->
    <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>2.6.5</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>2.6.5</version>
    </dependency>
    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpclient</artifactId>
      <version>4.3.1</version>
    </dependency>

    <!-- util dependencies -->
    <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>
      <scope>provided</scope>
    </dependency>

    <!-- test dependencies -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-all</artifactId>
      <version>1.3</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-all</artifactId>
      <version>1.9.5</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mock-server</groupId>
      <artifactId>mockserver-netty</artifactId>
      <version>3.10.2</version>
      <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>
      <version>9.4.1208</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <profiles>
    <profile>
      <id>integration-test</id>
      <properties>
        <gitlab.version>8.5.8</gitlab.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:9.4-15</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>
                    </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>
                  <run>
                    <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>
                      <GITLAB_PORT>${gitlab.http.port}</GITLAB_PORT>
                      <GITLAB_SSH_PORT>${gitlab.ssh.port}</GITLAB_SSH_PORT>
                      <GITLAB_SECRETS_DB_KEY_BASE>abc123</GITLAB_SECRETS_DB_KEY_BASE>
                    </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>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
