<?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.thorntail</groupId>
    <artifactId>microprofile-config-wildfly</artifactId>
    <version>1.7.1.redhat-00008</version>
  </parent>

  <groupId>io.thorntail</groupId>
  <artifactId>microprofile-config-wildfly-config-api</artifactId>
  <name>Thorntail: Config API for MicroProfile Config</name>
  <packaging>jar</packaging>

  <dependencies>
    <dependency>
      <groupId>io.thorntail</groupId>
      <artifactId>config-api-runtime</artifactId>
    </dependency>
    <dependency>
      <groupId>org.wildfly.core</groupId>
      <artifactId>wildfly-controller</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.thorntail</groupId>
      <artifactId>config-api-generator</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <dependencies>
          <dependency>
            <groupId>io.thorntail</groupId>
            <artifactId>config-api-generator</artifactId>
            <version>${version.io.thorntail.config-api}</version>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <phase>generate-sources</phase>
            <goals>
              <goal>java</goal>
            </goals>
            <configuration>
              <mainClass>org.wildfly.swarm.config.generator.generator.Generator</mainClass>
              <includePluginDependencies>true</includePluginDependencies>
              <includeProjectDependencies>true</includeProjectDependencies>
              <arguments>
                <argument>${project.basedir}/src/main/resources/generator-config.json</argument>
                <argument>${project.build.directory}/generated-sources</argument>
                <argument>${project.groupId}:${project.artifactId}:${project.version}</argument>
              </arguments>
              <systemProperties>
                <systemProperty>
                  <key>java.util.logging.SimpleFormatter.format</key>
                  <value>%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %4$-6s %2$s %5$s%6$s%n</value>
                </systemProperty>
              </systemProperties>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${project.build.directory}/generated-sources</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <executions>
          <execution>
            <id>verify</id>
            <phase>verify</phase>
            <configuration>
              <sourceDirectories>
                <sourceDirectory>${project.build.directory}/generated-sources</sourceDirectory>
              </sourceDirectories>
              <configLocation>checkstyle.xml</configLocation>
              <encoding>UTF-8</encoding>
              <consoleOutput>true</consoleOutput>
              <logViolationsToConsole>true</logViolationsToConsole>
              <failsOnError>true</failsOnError>
            </configuration>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.wildfly.plugins</groupId>
        <artifactId>wildfly-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>start</id>
            <goals>
              <goal>start</goal>
            </goals>
            <phase>validate</phase>
            <configuration>
              <groupId>io.thorntail</groupId>
              <artifactId>microprofile-config-wildfly-dist</artifactId>
              <version>${project.version}</version>
              <packaging>zip</packaging>
              <server-config>standalone-microprofile.xml</server-config>
            </configuration>
          </execution>
          <execution>
            <id>stop</id>
            <goals>
              <goal>shutdown</goal>
            </goals>
            <phase>package</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <systemProperties>
            <property>
              <name>APIGEN_CFG_DIR</name>
              <value>${project.basedir}/src/main/resources</value>
            </property>
            <property>
              <name>java.util.logging.SimpleFormatter.format</name>
              <value>%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %4$-6s %2$s %5$s%6$s%n</value>
            </property>
          </systemProperties>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <configuration>
          <show>public</show>
          <reportOutputDirectory>${project.reporting.outputDirectory}/${project.version}</reportOutputDirectory>
          <header>MicroProfile Config WildFly Configuration API, ${project.version}</header>
          <footer>MicroProfile Config WildFly Configuration API, ${project.version}</footer>
          <doctitle>MicroProfile Config WildFly Configuration API, ${project.version}</doctitle>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
