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

  <parent>
    <groupId>org.sonatype.oss</groupId>
    <artifactId>oss-parent</artifactId>
    <version>9</version>
  </parent>

  <prerequisites>
    <maven>${maven.required.version}</maven>
  </prerequisites>

  <groupId>net.wouterdanes.docker</groupId>
  <artifactId>docker-maven-plugin</artifactId>
  <version>3.1.0</version>
  <packaging>maven-plugin</packaging>

  <name>Docker Maven Plugin</name>

  <description>
    A plugin designed to wrap the docker API to prepare docker images for integration testing. Tested containers can
    then be pushed to a central docker repository and deployed into production.
  </description>

  <url>https://github.com/wouterd/docker-maven-plugin</url>

  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
      <comments>A business-friendly OSS license</comments>
    </license>
  </licenses>

  <scm>
    <url>https://github.com/wouterd/docker-maven-plugin</url>
    <connection>scm:git:git@github.com:wouterd/docker-maven-plugin.git</connection>
    <developerConnection>scm:git:git@github.com:wouterd/docker-maven-plugin.git</developerConnection>
  </scm>

  <issueManagement>
    <system>Github</system>
    <url>https://github.com/wouterd/docker-maven-plugin/issues</url>
  </issueManagement>

  <ciManagement>
    <system>Travis-ci</system>
    <url>https://travis-ci.org/wouterd/docker-maven-plugin</url>
  </ciManagement>

  <developers>
    <developer>
      <url>http://www.wouterdanes.net</url>
      <name>Wouter Danes</name>
      <email>wouter.danes@gmail.com</email>
      <id>wouterd</id>
      <timezone>CET</timezone>
      <roles>
        <role>Developer</role>
      </roles>
    </developer>
  </developers>

  <contributors>
    <contributor>
      <name>Lachlan Coote</name>
      <url>https://github.com/lcoote</url>
      <roles>
        <role>Developer</role>
      </roles>
    </contributor>
  </contributors>

  <properties>
    <maven.required.version>3.1.1</maven.required.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
    <docker.host />
    <docker.port />
  </properties>

  <dependencies>
    <!-- Maven dependencies -->
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-api</artifactId>
      <version>${maven.required.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-core</artifactId>
      <version>${maven.required.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.plugin-tools</groupId>
      <artifactId>maven-plugin-annotations</artifactId>
      <version>3.2</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-utils</artifactId>
      <version>3.0.8</version>
    </dependency>
    <!-- For Optional and Functional Programming -->
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>16.0.1</version>
    </dependency>
    <!-- For Doing REST calls and translating to/from Json -->
    <dependency>
      <groupId>org.glassfish.jersey.core</groupId>
      <artifactId>jersey-client</artifactId>
      <version>2.11</version>
    </dependency>
    <dependency>
      <groupId>org.codehaus.jackson</groupId>
      <artifactId>jackson-mapper-asl</artifactId>
      <version>1.9.13</version>
    </dependency>
    <dependency>
      <groupId>com.google.code.gson</groupId>
      <artifactId>gson</artifactId>
      <version>2.3.1</version>
    </dependency>
    <!-- library to read .pem certs & keys for encrypted ssl connection to docker daemon -->
    <dependency>
      <groupId>org.bouncycastle</groupId>
      <artifactId>bcpkix-jdk15on</artifactId>
      <version>1.51</version>
    </dependency>
    <!-- Needed to build tar.gz archives for the docker build engine -->
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-compress</artifactId>
      <version>1.8</version>
    </dependency>
    <!-- Test dependencies -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.8.2</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.glassfish.jersey.media</groupId>
      <artifactId>jersey-media-json-jackson</artifactId>
      <version>2.11</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-plugin-plugin</artifactId>
        <version>3.3</version>
        <configuration>
          <goalPrefix>docker</goalPrefix>
          <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
        </configuration>
        <executions>
          <execution>
            <id>mojo-descriptor</id>
            <goals>
              <goal>descriptor</goal>
            </goals>
          </execution>
          <execution>
            <id>help-goal</id>
            <goals>
              <goal>helpmojo</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>${maven.compiler.source}</source>
          <target>${maven.compiler.target}</target>
          <encoding>${project.build.sourceEncoding}</encoding>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>1.3.1</version>
        <executions>
          <execution>
            <id>enforce-maven-version</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireMavenVersion>
                  <version>${maven.required.version}</version>
                </requireMavenVersion>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>run-its</id>
      <build>
        <plugins>
          <plugin>
            <groupId>net.wouterdanes.docker</groupId>
            <artifactId>docker-maven-plugin</artifactId>
            <version>2.3</version>
            <executions>
              <execution>
                <id>start-containers</id>
                <goals>
                  <goal>start-containers</goal>
                </goals>
                <configuration>
                  <containers>
                    <container>
                      <id>registry</id>
                      <image>registry:0.8.0</image>
                    </container>
                  </containers>
                </configuration>
              </execution>
              <execution>
                <id>stop-containers</id>
                <goals>
                  <goal>stop-containers</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-invoker-plugin</artifactId>
            <version>1.8</version>
            <configuration>
              <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
              <postBuildHookScript>verify</postBuildHookScript>
              <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
              <settingsFile>src/it/settings.xml</settingsFile>
              <goals>
                <goal>deploy</goal>
              </goals>
              <streamLogs>true</streamLogs>
              <showErrors>true</showErrors>
            </configuration>
            <executions>
              <execution>
                <id>integration-test</id>
                <goals>
                  <goal>install</goal>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <ignoreFailures>true</ignoreFailures>
                  <properties>
                    <docker.host>${docker.host}</docker.host>
                    <docker.port>${docker.port}</docker.port>
                    <docker.provider>${docker.provider}</docker.provider>
                    <docker.registry>${docker.containers.registry.ports.5000/tcp.host}:${docker.containers.registry.ports.5000/tcp.port}</docker.registry>
                  </properties>
                </configuration>
              </execution>
              <execution>
                <id>verify</id>
                <goals>
                  <goal>verify</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>2.17</version>
            <executions>
              <execution>
                <id>integration-test</id>
                <goals>
                  <goal>integration-test</goal>
                </goals>
                <configuration>
                  <systemProperties>
                    <docker.registry>http://${docker.containers.registry.ports.5000/tcp.host}:${docker.containers.registry.ports.5000/tcp.port}</docker.registry>
                  </systemProperties>
                </configuration>
              </execution>
              <execution>
                <id>verify</id>
                <goals>
                  <goal>verify</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
