<?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>org.squashtest.tm</groupId>
    <artifactId>dataset-builder-parent</artifactId>
    <version>15.0.0-springboot4.IT4</version>
  </parent>

  <artifactId>dtd-generator</artifactId>
  <packaging>jar</packaging>

  <properties>
    <h2.driver>org.h2.Driver</h2.driver>
    <h2.password>sa</h2.password>
    <h2.url>jdbc:h2:${project.build.directory}/data/squash-tm;NON_KEYWORDS=ROW,VALUE</h2.url>
    <h2.username>sa</h2.username>
    <master.changelog>global.changelog-master.xml</master.changelog>
  </properties>

  <dependencies>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>core.foundation</artifactId>
    </dependency>

    <dependency>
      <groupId>org.dbunit</groupId>
      <artifactId>dbunit</artifactId>
    </dependency>

    <dependency>
      <groupId>com.h2database</groupId>
      <artifactId>h2</artifactId>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.liquibase</groupId>
        <artifactId>liquibase-maven-plugin</artifactId>
        <executions>
          <!-- Performs full import in h2 -->
          <execution>
            <id>create-h2-database</id>
            <goals>
              <goal>update</goal>
            </goals>
            <phase>generate-sources</phase>
            <configuration>
              <dropFirst>true</dropFirst>
              <clearCheckSums>true</clearCheckSums>
              <changeLogFile>${master.changelog}</changeLogFile>
              <driver>${h2.driver}</driver>
              <url>${h2.url}</url>
              <username>${h2.username}</username>
              <password>${h2.password}</password>
              <searchPath>${maven.multiModuleProjectDirectory}/database/src/main/liquibase</searchPath>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>generate-dtd</id>
            <goals>
              <goal>java</goal>
            </goals>
            <phase>process-classes</phase>
            <configuration>
              <mainClass>org.squashtest.it.dtdgenerator.DbUnitDtdGenerator</mainClass>
              <cleanupDaemonThreads>false</cleanupDaemonThreads>
              <systemProperties>
                <systemProperty>
                  <key>basedir</key>
                  <value>${project.basedir}</value>
                </systemProperty>
                <systemProperty>
                  <key>db.url</key>
                  <value>${h2.url}</value>
                </systemProperty>
                <systemProperty>
                  <key>db.username</key>
                  <value>${h2.username}</value>
                </systemProperty>
                <systemProperty>
                  <key>db.password</key>
                  <value>${h2.password}</value>
                </systemProperty>
              </systemProperties>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
