<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>

    <groupId>ch.zizka.junitdiff</groupId>
    <artifactId>JUnitDiff</artifactId>
    <packaging>jar</packaging>
    <version>2.1.0</version>

    <name>JUnitDiff</name>
    <description>JUnitDiff creates a HTML table from JUnit results. Rows are tests, columns are runs. Clicking the statuses reveals a pop-up with the logs and the stacktrace if any. </description>
    <url>https://github.com/OndraZizka/junitdiff</url>
    <!--    <url>http://ondra.zizka.cz/stranky/programovani/java/junit-test-results-report-comparison-junitdiff.texy</url> -->
    <licenses><license><name>The Apache Software License, Version 2.0</name><url>http://www.apache.org/licenses/LICENSE-2.0.txt</url><distribution>repo</distribution></license></licenses>
    <developers><developer><name>Ondrej Zizka</name><email>zizka@seznam.cz</email></developer></developers>
    <issueManagement><system>GitHub Issues</system><url>https://github.com/OndraZizka/junitdiff/issues</url></issueManagement>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <version.java>11</version.java>
        <version.kotlin>1.8.0-Beta</version.kotlin>
        <version.kotlin-dokka>1.7.20</version.kotlin-dokka>
        <mainClass>ch.zizka.junitdiff.JUnitDiffApp</mainClass>
        <distDir>${project.basedir}/./dist</distDir>
        <jvm.args.debug />
        <kotlin.version>2.1.0</kotlin.version>
        <kotlin.compiler.incremental>true</kotlin.compiler.incremental>
    </properties>
    
    <scm>
        <url>https://github.com/OndraZizka/junitdiff</url>
        <connection>scm:git:git://github.com/OndraZizka/junitdiff.git</connection>
        <developerConnection>scm:git:git@github.com:OndraZizka/junitdiff.git</developerConnection>
      <tag>JUnitDiff-2.1.0</tag>
  </scm>

    <build>

        <resources>
            <!-- This allows to have resources next to java files. For convenience in IDE. -->
            <resource>
                <directory>src/main/java</directory>
                <excludes><exclude>**/*.java</exclude></excludes>
            </resource>
            <!-- This is the default resources dir; the resource above would disable it. -->
            <resource> <directory>src/main/resources</directory> </resource>
            <resource> <directory>xslt</directory>
                <filtering>true</filtering>
                <includes><include>*.xsl</include></includes>
            </resource>
        </resources>

        <plugins>
          
            <!-- Compiler -->
            <plugin>
                <groupId>org.jetbrains.kotlin</groupId><artifactId>kotlin-maven-plugin</artifactId><version>${kotlin.version}</version>
                <executions>
                    <execution><id>compile</id><phase>compile</phase><goals><goal>compile</goal></goals></execution>
                    <execution><id>test-compile</id><phase>test-compile</phase><goals><goal>test-compile</goal></goals></execution>
                </executions>
                <configuration>
                    <jvmTarget>${version.java}</jvmTarget>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.14.0</version>
                <executions>
                    <execution><id>default-compile</id><goals><goal>compile</goal></goals><phase>none</phase></execution>
                    <execution><id>default-test-compile</id><goals><goal>testCompile</goal></goals><phase>none</phase></execution>
                </executions>
                <configuration><source>${version.java}</source><target>${version.java}</target></configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>  <artifactId>maven-antrun-plugin</artifactId> <version>3.1.0</version>
                <executions>
                    <execution>
                        <phase>clean</phase>  <goals><goal>run</goal></goals>
                        <configuration> <target>
                            <unzip src="src/test/data/hibernate-ann-run1.zip" dest="target/sample-data/" overwrite="true" />
                            <unzip src="src/test/data/hibernate-ann-run2.zip" dest="target/sample-data/" overwrite="true" />
                            <unzip src="src/test/data/hibernate-ann-run3.zip" dest="target/sample-data/" overwrite="true" />
                        </target> </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId><artifactId>maven-assembly-plugin</artifactId><version>3.7.1</version>
                <!-- The executable JAR(s), flattened -->
                <executions>
                    <execution><phase>package</phase><goals><goal>single</goal></goals>
                        <configuration>
                            <appendAssemblyId>true</appendAssemblyId>
                            <finalName>${project.artifactId}</finalName>
                            <outputDirectory>${project.build.directory}/dist</outputDirectory>
                            <descriptorRefs><descriptorRef>jar-with-dependencies</descriptorRef></descriptorRefs>
                            <archive>
                                <manifest> <!-- Jar - MANIFEST.MF options. -->
                                    <addClasspath>false</addClasspath>
                                    <mainClass>${mainClass}</mainClass>
                                    <classpathPrefix>lib/</classpathPrefix>
                                </manifest>
                                <manifestEntries>
                                    <Release-Version>${project.version}</Release-Version>
                                </manifestEntries>
                            </archive>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId><artifactId>maven-surefire-plugin</artifactId><version>3.5.3</version>
                <configuration>
                    <workingDirectory>target/</workingDirectory>
                    <systemPropertyVariables>
                        <junitdiff.test.data.dir>${basedir}/src/test/data</junitdiff.test.data.dir>
                    </systemPropertyVariables>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId><artifactId>maven-enforcer-plugin</artifactId><version>3.5.0</version>
                <executions><execution><id>enforce-maven</id><goals><goal>enforce</goal></goals></execution></executions>
                <configuration><rules><requireMavenVersion><version>3.8.1</version></requireMavenVersion></rules></configuration>
            </plugin>


        </plugins>

        <pluginManagement>
            <plugins>
                <plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-clean-plugin</artifactId><version>3.4.1</version></plugin>
                <plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-dependency-plugin</artifactId><version>3.8.1</version></plugin>
                <plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-deploy-plugin</artifactId><version>3.1.4</version></plugin>
                <plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-install-plugin</artifactId><version>3.1.2</version></plugin>
                <plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-jar-plugin</artifactId><version>3.4.2</version></plugin>
                <plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-release-plugin</artifactId><version>3.1.1</version></plugin>
                <plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-resources-plugin</artifactId><version>3.3.1</version></plugin>
                <plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-source-plugin</artifactId><version>3.3.1</version></plugin>
                <plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-site-plugin</artifactId><version>4.0.0-M7</version></plugin>
                <plugin><groupId>org.codehaus.mojo</groupId><artifactId>exec-maven-plugin</artifactId><version>3.5.0</version></plugin>
            </plugins>
        </pluginManagement>

    </build>

    <profiles>

        <!-- Debug. -->
        <profile>
            <id>debug</id> <activation><property><name>debug</name></property></activation>
            <properties>
                <jvm.args.debug>-Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=y</jvm.args.debug>
            </properties>
        </profile>

        <profile>
            <id>packageDistributable</id> <activation><property><name>release</name></property></activation>
            <build>
                <plugins>
                    <!-- Copy the dependencies to /lib -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId><artifactId>maven-dependency-plugin</artifactId>
                        <executions><execution><id>copyDeps</id><phase>prepare-package</phase><goals><goal>copy-dependencies</goal></goals></execution></executions>
                        <configuration>
                            <outputDirectory>${project.build.directory}/lib</outputDirectory>
                            <excludeTransitive>false</excludeTransitive>
                            <stripVersion>false</stripVersion>
                        </configuration>
                    </plugin>
                    <!-- Add the /lib above to the classPath. -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId><artifactId>maven-jar-plugin</artifactId>
                        <executions>
                            <execution> <!-- If the jars are within a jar, it would need a special classloader. -->
                                <id>executable</id><goals><goal>jar</goal></goals><phase>prepare-package</phase>
                                <configuration>
                                    <classifier>executable</classifier>
                                    <archive><manifest><addClasspath>true</addClasspath><classpathPrefix>lib/</classpathPrefix><mainClass>${mainClass}</mainClass></manifest></archive>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId><artifactId>maven-assembly-plugin</artifactId>
                        <executions>
                            <!-- Create the distributable ZIP. -->
                            <execution>
                                <id>assembleDistZip</id><goals><goal>single</goal></goals><phase>package</phase>
                                <configuration>
                                    <finalName>${project.artifactId}-${project.version}-dist</finalName>
                                    <appendAssemblyId>false</appendAssemblyId>
                                    <attach>true</attach>
                                    <archive>
                                        <manifest>
                                            <mainClass>${mainClass}</mainClass>
                                            <addClasspath>false</addClasspath>
                                            <classpathPrefix>lib/</classpathPrefix>
                                        </manifest>
                                    </archive>
                                    <descriptors><descriptor>src/build/assembly-dist.xml</descriptor></descriptors>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>e2eTest</id> <activation><property><name>release</name></property></activation>
            <build>
                <plugins>
                    <!-- One real execution of the tool from outside JUnit. -->
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId><artifactId>exec-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>testJunitDiffExecutable-simple</id><phase>integration-test</phase><goals><goal>exec</goal></goals>
                                <configuration>
                                    <executable>java</executable>
                                    <commandlineArgs>
                                        ${jvm.args.debug} -jar ${project.build.directory}/${project.artifactId}-${project.version}-executable.jar -o target/testE2eOutput/output.html
                                         src/test/data/hibernate-run1 src/test/data/hibernate-run2 src/test/data/hibernate-run3 src/test/data/hibernate-run4
                                    </commandlineArgs>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Release. -->
        <profile><id>release</id> <activation><property><name>release</name></property></activation>
            <properties>
                <ossrh.host>oss.sonatype.org</ossrh.host>
            </properties>

            <distributionManagement>
                <snapshotRepository><id>ossrh</id><name>ossrh</name><url>https://${ossrh.host}/content/repositories/snapshots</url></snapshotRepository>
                <repository><id>ossrh</id><name>ossrh</name><url>https://${ossrh.host}/service/local/staging/deploy/maven2/</url></repository>
            </distributionManagement>

            <build>
                <plugins>

                    <!-- Generate a JavaDoc and source jars -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId><artifactId>maven-source-plugin</artifactId>
                        <configuration><includes>**/*.kt</includes></configuration>
                        <executions><execution><id>attach-sources</id><goals><goal>jar</goal></goals></execution></executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId><artifactId>maven-javadoc-plugin</artifactId>
                        <executions><execution><id>attach-javadocs</id><goals><goal>jar</goal></goals></execution></executions>
                    </plugin>
                    <plugin>
                        <groupId>org.jetbrains.dokka</groupId>
                        <artifactId>dokka-maven-plugin</artifactId>
                        <version>${version.kotlin-dokka}</version>
                        <executions>
                            <execution><id>dokka-site</id><phase>pre-site</phase><goals><goal>dokka</goal></goals></execution>
                            <execution><id>dokka-jar</id><phase>package</phase><goals><goal>javadocJar</goal></goals></execution>
                        </executions>
                        <configuration><dokkaPlugins><plugin><groupId>org.jetbrains.dokka</groupId><artifactId>kotlin-as-java-plugin</artifactId><version>${version.kotlin-dokka}</version></plugin></dokkaPlugins></configuration>
                    </plugin>

                    <!-- Release plugin -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId><artifactId>maven-release-plugin</artifactId>
                        <configuration>
                            <autoVersionSubmodules>true</autoVersionSubmodules>
                            <useReleaseProfile>false</useReleaseProfile>
                            <releaseProfiles>release</releaseProfiles>
                            <goals>deploy</goals>
                        </configuration>
                    </plugin>

                    <plugin>
                        <groupId>org.sonatype.plugins</groupId><artifactId>nexus-staging-maven-plugin</artifactId><version>1.7.0</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://${ossrh.host}/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                            <!--
                            <attachedArtifacts>
                                <artifact>target/${project.artifactId}-${project.version}-dist.zip</artifact>
                            </attachedArtifacts>
                            -->
                        </configuration>
                    </plugin>

                    <!-- This relies on the gpg command being installed and the GPG credentials being available e.g. from settings.xml. -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId><artifactId>maven-gpg-plugin</artifactId><version>3.2.7</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals><goal>sign</goal></goals>
                                <configuration>
                                    <!-- On MacOS, remember to run this before Maven build: export GPG_TTY=$(tty) -->
                                    <keyname>73BA361CA92D829800730DE207838E30786B5257</keyname>
                                    <passphrase>${gpg.passphrase}</passphrase>
                                    <executable>${gpg.executable}</executable>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>

        </profile>

    </profiles>


    <dependencies>

        <dependency><groupId>org.jetbrains.kotlin</groupId><artifactId>kotlin-stdlib-jdk8</artifactId><version>${kotlin.version}</version></dependency>
        <dependency><groupId>org.jetbrains.kotlin</groupId><artifactId>kotlin-test-junit</artifactId><version>${kotlin.version}</version><scope>test</scope></dependency>

        <!-- Commons -->
        <dependency><groupId>org.apache.commons</groupId><artifactId>commons-lang3</artifactId><version>3.17.0</version></dependency>
        <dependency><groupId>org.apache.commons</groupId><artifactId>commons-text</artifactId><version>1.13.1</version></dependency>
        <dependency><groupId>commons-io</groupId><artifactId>commons-io</artifactId><version>2.19.0</version></dependency>

        <!-- JDom -->
        <!-- To upgrade to 2.x, see https://github.com/hunterhacker/jdom/wiki/JDOM2-Feature-XPath-Upgrade -->
        <dependency><groupId>org.jdom</groupId><artifactId>jdom</artifactId><version>1.1.3</version></dependency>
        <!-- JDom's XPath needs these, otherwise XPath.newInstance("/testsuite/testcase") throws... -->
        <dependency><groupId>org.jdom</groupId><artifactId>jaxen-core</artifactId><version>1.0-FCS</version></dependency> <!-- CNFEx org.jaxen.NamespaceContext -->
        <dependency><groupId>org.jdom</groupId><artifactId>jaxen-jdom</artifactId><version>1.0-FCS</version></dependency><!-- NoClassDefFoundError: org/jaxen/jdom/JDOMXPath: org/jaxen/jdom/JDOMXPath -->
        <dependency><groupId>org.jdom</groupId><artifactId>saxpath</artifactId><version>1.0-FCS</version></dependency><!-- CNFEx org.saxpath.SAXPathException -->

        <dependency><groupId>org.slf4j</groupId><artifactId>slf4j-api</artifactId><version>2.0.17</version></dependency>
        <dependency><groupId>org.slf4j</groupId><artifactId>jcl-over-slf4j</artifactId><version>2.0.17</version></dependency>
        <dependency><groupId>org.slf4j</groupId><artifactId>log4j-over-slf4j</artifactId><version>2.0.17</version></dependency><!-- for for Log4J 1.x -->
        <dependency><groupId>ch.qos.logback</groupId><artifactId>logback-classic</artifactId><version>1.5.18</version></dependency>
        <dependency><groupId>ch.qos.logback</groupId><artifactId>logback-core</artifactId><version>1.5.18</version></dependency>

        <!-- Test dependencies -->
        <dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.13.2</version><scope>test</scope></dependency>

    </dependencies>

    <pluginRepositories>
        <pluginRepository><id>codehaus</id><name>Codehaus Release Repo</name><url>http://repository.codehaus.org</url></pluginRepository>
        <pluginRepository><id>codehaus-snapshot</id><name>Codehaus Snapshot Repo</name><url>http://snapshots.repository.codehaus.org</url></pluginRepository>
    </pluginRepositories>

</project>