<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2023 Adrian Herscu
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     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/xsd/maven-4.0.0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>dev.aherscu.qa</groupId>
    <artifactId>qa-automation</artifactId>
    <version>0.0.21</version>
  </parent>

  <artifactId>qa-orcanos-publisher-maven-plugin</artifactId>
  <packaging>maven-plugin</packaging>

  <name>QA Orcanos Publisher Maven Plugin</name>
  <description>
    Binds to Maven's post-integration-test phase to publish test reports on
    Orcanos ALM, by uploading HTML/PDF reports as generated by QA JGiven
    Reporter Maven Plugin.
  </description>
  <url>
    https://github.com/QA-Automation-Starter/qa-automation/tree/main/qa-orcanos-publisher-maven-plugin
  </url>

  <properties>
    <xmlunit.version>2.7.0</xmlunit.version>
    <jaxb.output>${project.build.directory}/generated-sources/jaxb</jaxb.output>
    <!-- NOTE: integration tests are implemented to run against real Orcanos instance;
     do not run unless strictly required for debugging -->
    <skipITs>true</skipITs>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-api</artifactId>
      <version>${maven.version}</version>
    </dependency>

    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-core</artifactId>
      <version>${maven.version}</version>
    </dependency>

    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-compat</artifactId>
      <version>${maven.version}</version>
    </dependency>

    <!-- dependencies to annotations -->
    <dependency>
      <groupId>org.apache.maven.plugin-tools</groupId>
      <artifactId>maven-plugin-annotations</artifactId>
      <version>${maven.version}</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>dev.aherscu.qa</groupId>
      <artifactId>qa-tester-utils</artifactId>
      <version>0.0.21</version>
    </dependency>

    <dependency>
      <groupId>dev.aherscu.qa</groupId>
      <artifactId>qa-jgiven-reporter</artifactId>
      <version>0.0.21</version>
    </dependency>

    <dependency>
      <groupId>com.j2html</groupId>
      <artifactId>j2html</artifactId>
      <version>1.4.0</version>
    </dependency>

    <dependency>
      <groupId>org.glassfish.jersey.core</groupId>
      <artifactId>jersey-client</artifactId>
      <version>${jersey.version}</version>
    </dependency>

    <dependency>
      <groupId>org.glassfish.jersey.inject</groupId>
      <artifactId>jersey-hk2</artifactId>
      <version>${jersey.version}</version>
    </dependency>

    <dependency>
      <groupId>org.glassfish.jersey.media</groupId>
      <artifactId>jersey-media-json-jackson</artifactId>
      <version>${jersey.version}</version>
    </dependency>

    <dependency>
      <groupId>org.glassfish.jersey.ext.rx</groupId>
      <artifactId>jersey-rx-client-rxjava2</artifactId>
      <version>${jersey.version}</version>
    </dependency>

    <dependency>
      <groupId>org.glassfish.jersey.media</groupId>
      <artifactId>jersey-media-multipart</artifactId>
      <version>${jersey.version}</version>
    </dependency>

    <dependency>
      <groupId>org.apache.maven.plugin-testing</groupId>
      <artifactId>maven-plugin-testing-harness</artifactId>
      <!-- NOTE: does not match the latest version of Maven -->
      <version>3.3.0</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <!-- NOTE: this version matches the one used by
        maven-plugin-testing-harness above -->
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>com.github.tomakehurst</groupId>
      <artifactId>wiremock-jre8</artifactId>
      <version>2.26.3</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.xmlunit</groupId>
      <artifactId>xmlunit-core</artifactId>
      <version>${xmlunit.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.xmlunit</groupId>
      <artifactId>xmlunit-matchers</artifactId>
      <version>${xmlunit.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok-maven-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-plugin-plugin</artifactId>
        <version>${maven.version}</version>
      </plugin>

      <plugin>
        <groupId>net.revelc.code</groupId>
        <artifactId>impsort-maven-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>net.revelc.code.formatter</groupId>
        <artifactId>formatter-maven-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>jaxb2-maven-plugin</artifactId>
        <version>2.5.0</version>
        <executions>
          <execution>
            <id>xjc</id>
            <goals>
              <goal>xjc</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <outputDirectory>${jaxb.output}</outputDirectory>
          <packageName>dev.aherscu.qa.orcanos.publisher.maven.plugin.model
          </packageName>
        </configuration>
      </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>${jaxb.output}</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
      </plugin>

      <plugin>
        <artifactId>maven-failsafe-plugin</artifactId>
        <dependencies>
          <dependency>
            <groupId>org.apache.maven.surefire</groupId>
            <artifactId>surefire-junit3</artifactId>
            <version>${surefire.version}</version>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <id>integration-tests</id>
            <!-- NOTE: disabled by default, see skipITs above -->
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>platform-jdk11</id>
      <activation>
        <jdk>[11,)</jdk>
      </activation>
      <properties>
        <jaxb.version>2.3.1</jaxb.version>
      </properties>
      <dependencies>
        <dependency>
          <!-- ISSUE duplicated from qa-s3-uploader-maven-plugin -->
          <!-- TODO somehow move it to parent -->
          <groupId>com.sun.activation</groupId>
          <artifactId>javax.activation</artifactId>
          <version>1.2.0</version>
          <scope>runtime</scope>
        </dependency>
        <dependency>
          <groupId>javax.xml.bind</groupId>
          <artifactId>jaxb-api</artifactId>
          <version>${jaxb.version}</version>
          <scope>runtime</scope>
        </dependency>
        <dependency>
          <groupId>org.glassfish.jaxb</groupId>
          <artifactId>jaxb-runtime</artifactId>
          <version>${jaxb.version}</version>
          <scope>runtime</scope>
        </dependency>
      </dependencies>
    </profile>
  </profiles>
</project>
