<!--
  Licensed to the Technische Universität Darmstadt under one
  or more contributor license agreements. See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership. The Technische Universität Darmstadt
  licenses this file to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License.

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->

<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.dkpro.jwpl</groupId>
    <artifactId>dkpro-jwpl</artifactId>
    <version>2.0.2</version>
  </parent>
  <artifactId>dkpro-jwpl-revisionmachine</artifactId>
  <name>RevisionMachine</name>

  <dependencies>
    <dependency>
      <groupId>org.dkpro.jwpl</groupId>
      <artifactId>dkpro-jwpl-api</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-compress</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-slf4j2-impl</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-core</artifactId>
      <scope>provided</scope>
    </dependency>

    <!-- TEST dependencies -->
    <dependency>
      <groupId>org.mariadb.jdbc</groupId>
      <artifactId>mariadb-java-client</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <profiles>
    <profile>
      <id>test-e2e-tools</id>
      <properties>
        <build.profile.id>test-e2e-tools</build.profile.id>
        <!--
          End2End tests are run when the test-e2e-tools profile is active
        -->
        <skip.e2e.tests>false</skip.e2e.tests>
      </properties>
    </profile>
  </profiles>

  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <!-- Configures the source directory of our e2e tests -->
          <execution>
            <id>add-e2e-test-sources</id>
            <phase>generate-test-sources</phase>
            <goals>
              <goal>add-test-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>src/test-e2e/java</source>
              </sources>
            </configuration>
          </execution>
          <!-- Configures the resource directory of our e2e tests -->
          <execution>
            <id>add-e2e-test-resources</id>
            <phase>generate-test-resources</phase>
            <goals>
              <goal>add-test-resource</goal>
            </goals>
            <configuration>
              <resources>
                <resource>
                  <filtering>false</filtering>
                  <directory>src/test-e2e/resources</directory>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <configuration>
          <excludes>
            <!-- exclude it here as we only want to add it to the fat jar -->
            <exclude>**/log4j2.xml</exclude>
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <excludes>
            <!-- exclude it here as we only want to add it to the fat jar -->
            <exclude>**/log4j2.xml</exclude>
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <execution>
            <id>create-executable-jar</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <attach>false</attach>
              <descriptors>
                <descriptor>src/main/assembly/assembly.xml</descriptor>
              </descriptors>
              <archive>
                <manifest>
                  <mainClass>org.dkpro.jwpl.revisionmachine.difftool.DiffTool</mainClass>
                </manifest>
              </archive>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <argLine>-Xms256m -Xmx256m -Dfile.encoding=UTF-8 --add-opens=java.base/java.lang=ALL-UNNAMED</argLine>
          <excludes>
            **/*E2ETest.java
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>${maven.failsafe.plugin}</version>
        <configuration>
          <!-- Needs to be '0' here to allow logger output from the JAR process to be redirected correctly -->
          <forkCount>0</forkCount>
          <argLine>-Xms256m -Xmx384m -Dfile.encoding=UTF-8</argLine>
          <includes>
            **/*E2ETest.java
          </includes>
          <systemPropertyVariables>
            <jwpl.tool.name>${project.artifactId}-${project.version}-jar-with-dependencies.jar</jwpl.tool.name>
            <jwpl.wiki.name>aawiki</jwpl.wiki.name>
          </systemPropertyVariables>
        </configuration>
        <executions>
          <execution>
            <!-- Needs to be called late (post package) as we e2e-test a shaded jar file -->
            <phase>verify</phase>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
            <configuration>
              <skipITs>${skip.e2e.tests}</skipITs>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
