<?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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>io.fabric8.forge</groupId>
    <artifactId>forge-parent</artifactId>
    <version>2.2.171</version>
  </parent>
  <groupId>io.fabric8.forge.apps</groupId>
  <artifactId>fabric8-forge</artifactId>
  <name>Fabric8 :: Forge</name>
  <description>Fabric8 :: Forge</description>
  <properties>
    <addon.repository>${project.build.directory}/addon-repository</addon.repository>
    <docker.assemblyDescriptor>${basedir}/src/main/fabric8/assembly.xml</docker.assemblyDescriptor>
    <docker.assemblyDescriptorRef>artifact-with-dependencies</docker.assemblyDescriptorRef>
    <docker.env.FORGE_ADDON_DIRECTORY>/forge-addon-repo</docker.env.FORGE_ADDON_DIRECTORY>
    <docker.from>docker.io/fabric8/jetty-9:1.0.0</docker.from>
    <docker.image>fabric8/${project.artifactId}:${project.version}</docker.image>
    <docker.port.container.jolokia>8778</docker.port.container.jolokia>
    <fabric8.env.FABRIC8_ARCHETYPES_VERSION>${fabric8.archetypes.release.version}</fabric8.env.FABRIC8_ARCHETYPES_VERSION>
    <fabric8.iconRef>icons/java</fabric8.iconRef>
    <fabric8.label.project>fabric8-forge</fabric8.label.project>
    <fabric8.label.provider>fabric8</fabric8.label.provider>
    <fabric8.label.version>${project.version}</fabric8.label.version>
    <fabric8.readinessProbe.httpGet.path>/_ping</fabric8.readinessProbe.httpGet.path>
    <fabric8.readinessProbe.httpGet.port>${fabric8.service.containerPort}</fabric8.readinessProbe.httpGet.port>
    <fabric8.readinessProbe.initialDelaySeconds>30</fabric8.readinessProbe.initialDelaySeconds>
    <fabric8.service.containerPort>8080</fabric8.service.containerPort>
    <fabric8.service.port>80</fabric8.service.port>
    <fabric8.service.type>LoadBalancer</fabric8.service.type>
    <fabric8.serviceAccount>fabric8</fabric8.serviceAccount>
    <furnace.version>2.23.4.Final</furnace.version>
    <guava.version>15.0</guava.version>
    <jboss.forge.version>3.0.1.Final</jboss.forge.version>
    <wildfly.swarm.version>1.0.0.Beta3</wildfly.swarm.version>
  </properties>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>io.fabric8</groupId>
        <artifactId>fabric8-project</artifactId>
        <version>${fabric8.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.jboss.arquillian.junit</groupId>
        <artifactId>arquillian-junit-container</artifactId>
        <version>1.1.11.Final</version>
        <scope>test</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>io.fabric8.forge</groupId>
      <artifactId>fabric8-forge-web</artifactId>
      <version>${project.version}</version>
      <type>war</type>
    </dependency>
    <dependency>
      <groupId>io.fabric8.forge</groupId>
      <artifactId>camel</artifactId>
      <version>${project.version}</version>
      <classifier>forge-addon</classifier>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>io.fabric8.forge</groupId>
      <artifactId>devops</artifactId>
      <version>${project.version}</version>
      <classifier>forge-addon</classifier>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.forge.addon</groupId>
      <artifactId>wildfly-swarm</artifactId>
      <version>${wildfly.swarm.version}</version>
      <classifier>forge-addon</classifier>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.forge.addon</groupId>
      <artifactId>git</artifactId>
      <version>${jboss.forge.version}</version>
      <classifier>forge-addon</classifier>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>io.fabric8.archetypes</groupId>
      <artifactId>archetypes-catalog</artifactId>
      <version>${fabric8.archetypes.release.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.forge.furnace</groupId>
      <artifactId>furnace-se</artifactId>
      <version>${furnace.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.forge.furnace.container</groupId>
      <artifactId>simple-api</artifactId>
      <version>${furnace.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.forge.addon</groupId>
      <artifactId>templates-api</artifactId>
      <version>${jboss.forge.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.forge.addon</groupId>
      <artifactId>templates-freemarker</artifactId>
      <version>${jboss.forge.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.forge.addon</groupId>
      <artifactId>projects-api</artifactId>
      <version>${jboss.forge.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.forge.addon</groupId>
      <artifactId>maven-impl-projects</artifactId>
      <version>${jboss.forge.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.forge.addon</groupId>
      <artifactId>dependencies-api</artifactId>
      <version>${jboss.forge.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.forge.addon</groupId>
      <artifactId>parser-java-api</artifactId>
      <version>${jboss.forge.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.forge.addon</groupId>
      <artifactId>resources-api</artifactId>
      <version>${jboss.forge.version}</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <artifactId>facets-impl</artifactId>
          <groupId>org.jboss.forge.addon</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.shared</groupId>
      <artifactId>maven-invoker</artifactId>
      <version>2.2</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.fabric8</groupId>
      <artifactId>fabric8-arquillian</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.arquillian.junit</groupId>
      <artifactId>arquillian-junit-container</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <resources>
      <resource>
        <filtering>true</filtering>
        <directory>src/main/resources</directory>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <groupId>org.jboss.forge.furnace</groupId>
        <artifactId>furnace-maven-plugin</artifactId>
        <version>${furnace.version}</version>
        <executions>
          <execution>
            <id>deploy-addons</id>
            <phase>test-compile</phase>
            <goals>
              <goal>addon-install</goal>
            </goals>
            <inherited>false</inherited>
            <configuration>
              <addonRepository>${addon.repository}</addonRepository>
              <addonIds>
                <addonId>io.fabric8.forge:camel,${project.version}</addonId>
                <addonId>io.fabric8.forge:devops,${project.version}</addonId>
                <addonId>org.jboss.forge.addon:git,${jboss.forge.version}</addonId>
                <addonId>org.jboss.forge.addon:wildfly-swarm,${wildfly.swarm.version}</addonId>
              </addonIds>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${maven.surefire.plugin.version}</version>
        <configuration>
          <forkMode>perTest</forkMode>
          <systemPropertyVariables>
            <fabric8ArchetypeVersion>${fabric8.archetypes.release.version}</fabric8ArchetypeVersion>
          </systemPropertyVariables>
        </configuration>
      </plugin>
      <plugin>
        <groupId>io.fabric8</groupId>
        <artifactId>docker-maven-plugin</artifactId>
        <version>${docker.maven.plugin.version}</version>
        <configuration>
          <images>
            <image>
              <name>${docker.image}</name>
              <build>
                <from>${docker.from}</from>
                <assembly>
                  <descriptor>${docker.assemblyDescriptor}</descriptor>
                  <basedir>/</basedir>
                </assembly>
                <env>
                  <FORGE_ADDON_DIRECTORY>${docker.env.FORGE_ADDON_DIRECTORY}</FORGE_ADDON_DIRECTORY>
                  <FABRIC8_ARCHETYPES_VERSION>${fabric8.env.FABRIC8_ARCHETYPES_VERSION}</FABRIC8_ARCHETYPES_VERSION>
                </env>
                <ports>
                  <port>${fabric8.service.containerPort}</port>
                  <port>8778</port>
                </ports>
              </build>
            </image>
          </images>
        </configuration>
      </plugin>
      <plugin>
        <groupId>io.fabric8</groupId>
        <artifactId>fabric8-maven-plugin</artifactId>
        <version>${fabric8.version}</version>
        <executions>
          <execution>
            <id>json</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>json</goal>
            </goals>
          </execution>
          <execution>
            <id>attach</id>
            <phase>package</phase>
            <goals>
              <goal>attach</goal>
            </goals>
          </execution>
          <execution>
            <id>helm</id>
            <phase>package</phase>
            <goals>
              <goal>helm</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <replaceReadmeLinksPrefix>/apps/</replaceReadmeLinksPrefix>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>docker-build</id>
      <build>
        <plugins>
          <plugin>
            <groupId>io.fabric8</groupId>
            <artifactId>docker-maven-plugin</artifactId>
            <version>${docker.maven.plugin.version}</version>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>build</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>docker-push</id>
      <build>
        <plugins>
          <plugin>
            <groupId>io.fabric8</groupId>
            <artifactId>docker-maven-plugin</artifactId>
            <version>${docker.maven.plugin.version}</version>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>build</goal>
                  <goal>push</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>debug</id>
      <properties>
        <docker.port.container.debug>9999</docker.port.container.debug>
        <docker.port.host.debug>9999</docker.port.host.debug>
        <fabric8.env.JAVA_OPTIONS>-Xdebug -agentlib:jdwp=transport=dt_socket,address=9999,server=y,suspend=n</fabric8.env.JAVA_OPTIONS>
      </properties>
    </profile>
    <profile>
      <id>f8-build</id>
      <build>
        <defaultGoal>clean install docker:build fabric8:json</defaultGoal>
      </build>
    </profile>
    <profile>
      <id>f8-deploy</id>
      <build>
        <defaultGoal>clean install docker:build docker:push fabric8:json fabric8:apply</defaultGoal>
      </build>
      <properties>
        <fabric8.recreate>true</fabric8.recreate>
        <fabric8.imagePullPolicySnapshot>Always</fabric8.imagePullPolicySnapshot>
      </properties>
    </profile>
    <profile>
      <id>f8-local-deploy</id>
      <build>
        <plugins>
          <plugin>
            <groupId>io.fabric8</groupId>
            <artifactId>docker-maven-plugin</artifactId>
            <version>${docker.maven.plugin.version}</version>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>build</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>io.fabric8</groupId>
            <artifactId>fabric8-maven-plugin</artifactId>
            <version>${fabric8.version}</version>
            <executions>
              <execution>
                <id>json</id>
                <phase>generate-resources</phase>
                <goals>
                  <goal>json</goal>
                </goals>
              </execution>
              <execution>
                <id>attach</id>
                <phase>package</phase>
                <goals>
                  <goal>attach</goal>
                </goals>
              </execution>
              <execution>
                <id>apply</id>
                <phase>install</phase>
                <goals>
                  <goal>apply</goal>
                </goals>
              </execution>
              <execution>
                <id>helm</id>
                <phase>package</phase>
                <goals>
                  <goal>helm</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <replaceReadmeLinksPrefix>/apps/</replaceReadmeLinksPrefix>
            </configuration>
          </plugin>
        </plugins>
      </build>
      <properties>
        <fabric8.recreate>true</fabric8.recreate>
      </properties>
    </profile>
  </profiles>
</project>
