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

  <scm>
    <connection>scm:git:git@github.com:wildfly-swarm/wildfly-config-api.git</connection>
    <developerConnection>scm:git:git@github.com:wildfly-swarm/wildfly-config-api.git</developerConnection>
    <url>https://github.com/wildfly-swarm/wildfly-config-api</url>
    <tag>2.7.0</tag>
  </scm>

  <modelVersion>4.0.0</modelVersion>
  <artifactId>config-api</artifactId>
  <packaging>jar</packaging>

  <parent>
    <groupId>io.thorntail</groupId>
    <artifactId>config-api-parent</artifactId>
    <version>2.7.0</version>
    <relativePath>../</relativePath>
  </parent>

  <dependencies>
    <dependency>
      <groupId>io.thorntail</groupId>
      <artifactId>config-api-runtime</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.wildfly.core</groupId>
      <artifactId>wildfly-controller</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.wildfly.common</groupId>
      <artifactId>wildfly-common</artifactId>
    </dependency>   
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${version.junit}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.thorntail</groupId>
      <artifactId>config-api-generator</artifactId>
      <version>${project.version}</version>
      <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>${project.version}</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>
        <version>${version.wildfly-maven-plugin}</version>
        <executions>
          <execution>
            <id>start</id>
            <goals>
              <goal>start</goal>
            </goals>
            <phase>validate</phase>
            <configuration>
              <groupId>org.wildfly</groupId>
              <artifactId>wildfly-dist</artifactId>
              <version>${version.wildfly}</version>
              <server-config>standalone-full-ha.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>WildFly Configuration API, ${project.version}</header>
          <footer>WildFly Configuration API, ${project.version}</footer>
          <doctitle>WildFly Configuration API, ${project.version}</doctitle>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
