<?xml version="1.0"?>
<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>

  <!-- Artifact information -->
  <groupId>org.basex.modules</groupId>
  <artifactId>modules-parent</artifactId>
  <version>1.2</version>
  <packaging>pom</packaging>

  <properties>
    <compileSource>1.8</compileSource>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <project.lib.directory>lib</project.lib.directory>
    <junit.version>5.7.0</junit.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.basex</groupId>
      <artifactId>basex</artifactId>
      <version>9.6.1</version>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <!-- Project Information -->
  <name>BaseX Modules</name>
  <description>BaseX XQuery Modules</description>

  <repositories>
    <repository>
      <id>basex</id>
      <name>BaseX Maven Repository</name>
      <url>https://files.basex.org/maven</url>
    </repository>
    <repository>
      <id>central</id>
      <name>Central Maven Repository</name>
      <url>https://repo1.maven.org/maven2/</url>
    </repository>
  </repositories>

  <prerequisites>
    <maven>3.0.0</maven>
  </prerequisites>

  <!-- Build Settings -->
  <build>
    <finalName>${project.artifactId}-${project.version}</finalName>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.8.1</version>
          <inherited>true</inherited>
          <configuration>
            <source>${compileSource}</source>
            <target>${compileSource}</target>
            <!-- https://jira.codehaus.org/browse/MCOMPILER-205 -->
            <useIncrementalCompilation>false</useIncrementalCompilation>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.2.0</version>
          <inherited>true</inherited>
          <configuration>
            <archive>
              <manifest>
                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
              </manifest>
              <manifestEntries>
                <Implementation-Build>${buildNumber}</Implementation-Build>
              </manifestEntries>
            </archive>
            <excludes>
              <exclude>BaseX.class</exclude>
              <exclude>BaseXGUI.class</exclude>
            </excludes>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.22.2</version>
          <inherited>true</inherited>
          <configuration>
            <!-- most tests rely on extensions that are not available by default -->
            <skipTests>true</skipTests>
            <reuseForks>false</reuseForks>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>3.2.1</version>
          <inherited>true</inherited>
          <configuration>
            <outputDirectory>target</outputDirectory>
          </configuration>
          <executions>
            <execution>
              <id>attach-sources</id>
              <phase>package</phase>
              <goals>
                <goal>jar-no-fork</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>3.1.2</version>
          <inherited>true</inherited>
          <configuration>
            <outputDirectory>${project.lib.directory}</outputDirectory>
            <includeScope>runtime</includeScope>
          </configuration>
          <executions>
            <execution>
              <id>copy-libs</id>
              <phase>package</phase>
              <goals>
                <goal>copy-dependencies</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <!-- start: mvn exec:java -->
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>exec-maven-plugin</artifactId>
          <version>3.0.0</version>
          <inherited>true</inherited>
          <configuration>
            <mainClass>org.basex.BaseXGUI</mainClass>
          </configuration>
          <executions>
            <execution>
              <goals>
                <goal>java</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>2.8.2</version>
          <inherited>true</inherited>
        </plugin>
      </plugins>
    </pluginManagement>

    <extensions>
      <extension>
        <groupId>org.apache.maven.wagon</groupId>
        <artifactId>wagon-ssh</artifactId>
        <version>3.4.1</version>
      </extension>
    </extensions>
  </build>
</project>
