<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.11</version>
  </parent>
  <groupId>org.jenkins-ci.plugins</groupId>
  <artifactId>gogs-webhook</artifactId>
  <version>1.0.14</version>
  <packaging>hpi</packaging>

  <properties>
    <jenkins.version>1.625.3</jenkins.version>
    <java.level>8</java.level>
    <jenkins-test-harness.version>2.13</jenkins-test-harness.version>
    <java.level.test>8</java.level.test>
  </properties>

  <name>Jenkins Gogs plugin</name>
  <description>Adds Gogs integration to Jenkins</description>
  <url>https://wiki.jenkins-ci.org/display/JENKINS/Gogs+Webhook+Plugin</url>

  <licenses>
    <license>
      <name>The MIT license</name>
      <url>http://www.opensource.org/licenses/mit-license.php</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <developers>
    <developer>
      <id>sanderv32</id>
      <name>Alexander Verhaar</name>
    </developer>
  </developers>

  <dependencies>
    <dependency>
      <groupId>org.jenkins-ci.main</groupId>
      <artifactId>jenkins-war</artifactId>
      <type>war</type>
      <version>${jenkins.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.plugins</groupId>
      <artifactId>git</artifactId>
      <version>2.2.5</version>
    </dependency>
    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpclient</artifactId>
      <version>4.5.1</version>
    </dependency>
    <dependency>
      <groupId>commons-codec</groupId>
      <artifactId>commons-codec</artifactId>
      <version>1.10</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</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>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>17.0</version>
      <!--<scope>test</scope>-->
    </dependency>
    <!--<dependency>-->
    <!--<groupId>org.apache.httpcomponents</groupId>-->
    <!--<artifactId>httpclient</artifactId>-->
    <!--<version>4.5.3</version>-->
    <!--<scope>test</scope>-->
    <!--</dependency>-->
    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>fluent-hc</artifactId>
      <version>4.5.3</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jgit</groupId>
      <artifactId>org.eclipse.jgit</artifactId>
      <version>4.7.0.201704051617-r</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.offbytwo.jenkins</groupId>
      <artifactId>jenkins-client</artifactId>
      <version>0.3.7</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jenkins-ci.plugins</groupId>
      <artifactId>cloudbees-folder</artifactId>
      <version>6.3</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <profiles>
    <profile>
      <id>withIntegrationTest</id>
      <!--These tests can come in the way of somebody that doesn't have a docker ready environment. So it is better
      to give a way to skip them-->
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <version>3.0.2</version>
            <executions>
              <execution>
                <id>copy-HPI-to-dockerDir</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <configuration>
                  <outputDirectory>${basedir}/src/test/docker/jenkins-dockerfile</outputDirectory>
                  <resources>
                    <resource>
                      <directory>${basedir}/target</directory>
                      <includes>
                        <include>gogs-webhook.hpi</include>
                      </includes>
                    </resource>
                  </resources>
                </configuration>
              </execution>
              <execution>
                <id>copy-testSources</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <configuration>
                  <resources>
                    <resource>
                      <directory>${basedir}/src/test/test-repos</directory>
                      <includes>
                        <include>**/*</include>
                      </includes>
                    </resource>
                  </resources>
                  <outputDirectory>${basedir}/target/test-repos</outputDirectory>
                </configuration>
              </execution>

            </executions>
          </plugin>

          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.6.0</version>
            <executions>
              <execution>
                <id>start-test-environment</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>exec</goal>
                </goals>
                <configuration>
                  <executable>sh</executable>
                  <arguments>
                    <argument>${basedir}/src/test/scripts/start-test-environment.sh</argument>
                  </arguments>
                </configuration>
              </execution>
              <execution>
                <id>stop-test-environment</id>
                <phase>post-integration-test</phase>
                <goals>
                  <goal>exec</goal>
                </goals>
                <configuration>
                  <executable>sh</executable>
                  <arguments>
                    <argument>${basedir}/src/test/scripts/stop-test-environment.sh</argument>
                  </arguments>
                </configuration>
              </execution>
            </executions>
          </plugin>


          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>2.13</version>
            <executions>
              <execution>
                <id>integration-test</id>
                <goals>
                  <goal>integration-test</goal>
                </goals>
              </execution>
              <execution>
                <id>verify</id>
                <goals>
                  <goal>verify</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <!-- 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>
  </repositories>

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

  <scm>
    <connection>scm:git:ssh://github.com/jenkinsci/gogs-webhook-plugin.git</connection>
    <developerConnection>scm:git:ssh://git@github.com/jenkinsci/gogs-webhook-plugin.git</developerConnection>
    <url>https://github.com/jenkinsci/gogs-webhook-plugin</url>
    <tag>gogs-webhook-1.0.14</tag>
  </scm>
</project>
