<!--
  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-api</artifactId>
  <name>API</name>

  <properties>
    <!--
      By default, we skip the integration tests for regular contributors
      as they might not have access to one of the two institution specific
      MySQL resource profiles.
    -->
    <skip.integration.tests>true</skip.integration.tests>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.hibernate.orm</groupId>
      <artifactId>hibernate-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jgrapht</groupId>
      <artifactId>jgrapht-core</artifactId>
    </dependency>
    <dependency>
      <groupId>de.fau.cs.osr.utils</groupId>
      <artifactId>utils</artifactId>
    </dependency>
    <dependency>
      <groupId>de.fau.cs.osr.ptk</groupId>
      <artifactId>ptk-common</artifactId>
    </dependency>
    <dependency>
      <groupId>io.github.rzo1.org.sweble.wikitext</groupId>
      <artifactId>swc-parser-lazy</artifactId>
    </dependency>
    <dependency>
      <groupId>io.github.rzo1.org.sweble.wikitext</groupId>
      <artifactId>swc-engine</artifactId>
    </dependency>
    <dependency>
      <groupId>com.neovisionaries</groupId>
      <artifactId>nv-i18n</artifactId>
    </dependency>
    <dependency>
      <groupId>jakarta.persistence</groupId>
      <artifactId>jakarta.persistence-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
    </dependency>

    <!-- logger dependencies -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>

    <!-- Used in Integration Tests only -->
    <dependency>
      <groupId>org.mariadb.jdbc</groupId>
      <artifactId>mariadb-java-client</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <profiles>
    <profile>
      <!-- Activate if your machine has access to MariaDB DB resources at HHN in
      Heilbronn -->
      <id>test-it-perf-mariadb-hhn</id>
      <properties>
        <!-- Use SSH Port forwarding to access database @ HHN -->
        <database.host>localhost</database.host>
        <database.name>wikiapi_simple_20090119</database.name>
        <database.user>student</database.user>
        <database.password>student</database.password>
        <!-- Adjusted value to reduce stress level at HHN CI servers -->
        <performance.pages.retrieved>1000</performance.pages.retrieved>
        <performance.cycles.maxi>5</performance.cycles.maxi>
        <performance.cycles.page>20</performance.cycles.page>
      </properties>
    </profile>

    <profile>
      <id>junit</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <build.profile.id>dev</build.profile.id>
        <!--
          Only unit tests are run when the development profile is active.
          See global: 
          <skip.integration.tests>true</skip.integration.tests>
        -->
      </properties>
    </profile>

    <!-- The Configuration of the integration-test profile -->
    <profile>
      <id>integration-test</id>
      <properties>
        <build.profile.id>integration-test</build.profile.id>
        <!--
          Integration tests are run when the integration-test profile is active
        -->
        <skip.integration.tests>false</skip.integration.tests>
      </properties>
    </profile>

    <profile>
      <id>jacoco</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <forkMode>once</forkMode>
              <argLine>@{jacoco.argLine} -Xms256m -Xmx384m -Dfile.encoding=UTF-8 --add-opens=java.base/java.lang=ALL-UNNAMED</argLine>
              <!-- Show 100% of the lines from the stack trace (doesn't work) -->
              <trimStackTrace>false</trimStackTrace>
              <includes>
                <!-- Include unit tests within integration-test phase. -->
                <include>**/*Test.java</include>
              </includes>
              <excludes>
                <!-- Exclude integration tests within (unit) test phase. -->
                <exclude>**/*IT.java</exclude>
              </excludes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>false</filtering>
        <includes>
          <include>**/*</include>
        </includes>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <configuration>
          <sourceFileExcludes>
            <!-- exclude this specific file to avoid creating useless enum value javadoc for languages -->
            <sourceFileExclude>org/dkpro/jwpl/api/WikiConstants.java</sourceFileExclude>
          </sourceFileExcludes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>${maven.build.helper.plugin}</version>
        <executions>
          <!-- Configures the source directory of our integration tests -->
          <execution>
            <id>add-integration-test-sources</id>
            <phase>generate-test-sources</phase>
            <goals>
              <goal>add-test-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>src/it/java</source>
              </sources>
            </configuration>
          </execution>
          <!-- Configures the resource directory of our integration tests -->
          <execution>
            <id>add-integration-test-resources</id>
            <phase>generate-test-resources</phase>
            <goals>
              <goal>add-test-resource</goal>
            </goals>
            <configuration>
              <resources>
                <!--
                  Placeholders that are found from the files located in the configured resource
                  directories are replaced with the property values found from the profile
                  specific configuration file.
                -->
                <resource>
                  <filtering>true</filtering>
                  <directory>src/it/resources</directory>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <forkMode>once</forkMode>
          <argLine>-Xms256m -Xmx256m -Dfile.encoding=UTF-8
            --add-opens=java.base/java.lang=ALL-UNNAMED</argLine>
          <!-- Show 100% of the lines from the stack trace (doesn't work) -->
          <trimStackTrace>false</trimStackTrace>
          <includes>
            <!-- Include unit tests within integration-test phase. -->
            <include>**/*Test.java</include>
          </includes>
          <excludes>
            <!-- Exclude integration tests within (unit) test phase. -->
            <exclude>**/*IT.java</exclude>
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>${maven.failsafe.plugin}</version>
        <configuration>
          <argLine>-Xms256m -Xmx384m -Dfile.encoding=UTF-8</argLine>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
            <configuration>
              <skipITs>${skip.integration.tests}</skipITs>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
