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

    <organization>
        <name>filechampion.dev</name>
        <url>https://github.com/povimd9</url>
    </organization>
    <groupId>dev.filechampion</groupId>
    <artifactId>filechampion4j</artifactId>
    <version>0.9.8.2</version>
    <packaging>jar</packaging>
    <name>filechampion4j</name>
    <description>
        FileChampion4j is a powerful and flexible Java library for validating and processing files. 
        The library can be used to check files for a variety of properties, including mime type, magic bytes, header signatures, footer signatures, maximum size, and more. 
        The library can also execute extension plugins that are defined for the file type.
    </description>
    <url>https://github.com/povimd9/FileChampion4j</url>

    <licenses>
        <license>
            <name>Apache License 2.0 License</name>
            <url>https://github.com/povimd9/FileChampion4j/blob/master/LICENSE</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <name> povimd9 </name>
            <email>blumo@filechampion.dev</email>
            <organization>filechampion</organization>
            <organizationUrl>https://github.com/povimd9/FileChampion4j</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/povimd9/FileChampion4j.git</connection>
        <url>https://github.com/povimd9/FileChampion4j/tree/release-0.9.8.2</url>
    </scm>
    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>

    <dependencies>
        <!-- org.json -->
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20230227</version>
        </dependency>

        <!-- junit -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>5.9.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>5.9.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
            <version>5.9.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-launcher</artifactId>
            <version>1.9.3</version>
            <scope>test</scope>
        </dependency>

        <!-- JMH for benchmarking -->
        <dependency>
            <groupId>org.openjdk.jmh</groupId>
            <artifactId>jmh-core</artifactId>
            <version>1.36</version>
        </dependency>
        <dependency>
            <groupId>org.openjdk.jmh</groupId>
            <artifactId>jmh-generator-annprocess</artifactId>
            <version>1.36</version>
        </dependency>

        <!-- iText for pdf creation-->
        <dependency>
            <groupId>com.itextpdf</groupId>
            <artifactId>itextpdf</artifactId>
            <version>5.5.13.3</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <finalName>filechampion4j</finalName>
        <plugins>
            <!-- Set the JAVA_HOME environment variable to the JDK home directory -->
           <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>properties-maven-plugin</artifactId>
                <version>1.1.0</version>
                <executions>
                    <execution>
                    <id>java-home-placeholder</id>
                    <goals>
                        <goal>set-system-properties</goal>
                    </goals>
                    <configuration>
                        <properties>
                            <property>
                                <name>java8.home</name>
                                <value>${env.JAVA8_HOME}</value>
                            </property>
                            <property>
                                <name>java11.home</name>
                                <value>${env.JAVA11_HOME}</value>
                            </property>
                            <property>
                                <name>java17.home</name>
                                <value>${env.JAVA17_HOME}</value>
                            </property>
                            <property>
                                <name>blumo.jks</name>
                                <value>${env.BLUMO_JKS}</value>
                            </property>
                            <property>
                                <name>signkey.pass</name>
                                <value>${env.SIGN_KEY_PASS}</value>
                            </property>
                        </properties>
                    </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- Set a JDK compiler level -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.11.0</version>
                <executions>
                    <execution>
                        <id>compile-jdk8</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <source>1.8</source>
                            <target>1.8</target>
                            <fork>true</fork>
                            <executable>${java8.home}/bin/javac</executable>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- Generate list of dependencies -->
            <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>3.5.0</version>
            <executions>
                <execution>
                <id>generate-manifest</id>
                <phase>package</phase>
                <goals>
                    <goal>list</goal>
                </goals>
                <configuration>
                    <outputFile>${project.build.directory}/dependency-list.txt</outputFile>
                </configuration>
                </execution>
            </executions>
            </plugin>
            <!-- Make this jar executable -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.3.0</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                        </manifest>
                        <manifestEntries>
                            <Implementation-Title>${project.artifactId}</Implementation-Title>
                            <Implementation-Version>${project.version}</Implementation-Version>
                            <Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
                            <Built-By>povimd9</Built-By>
                            <SCM-URL>https://github.com/povimd9/filechampion4j</SCM-URL>
                            <SCM-Connection>scm:git:https://github.com/povimd9/filechampion4j</SCM-Connection>
                            <Doc-URL>https://github.com/povimd9/filechampion4j/wiki</Doc-URL>
                            <License>Apache-2.0";link="https://www.apache.org/licenses/LICENSE-2.0.txt</License>
                            <Build-Jdk-Spec>1.8</Build-Jdk-Spec>
                            <Dependencies>org.json:json</Dependencies>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
            <!-- Make a fat jar -->
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>3.5.0</version>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <appendAssemblyId>true</appendAssemblyId>
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                        </manifest>
                        <manifestEntries>
                            <Implementation-Title>${project.artifactId}</Implementation-Title>
                            <Implementation-Version>${project.version}</Implementation-Version>
                            <Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
                            <Built-By>povimd9</Built-By>
                            <SCM-URL>https://github.com/povimd9/filechampion4j</SCM-URL>
                            <SCM-Connection>scm:git:https://github.com/povimd9/filechampion4j</SCM-Connection>
                            <Doc-URL>https://github.com/povimd9/filechampion4j/wiki</Doc-URL>
                            <License>Apache-2.0";link="https://www.apache.org/licenses/LICENSE-2.0.txt</License>
                            <Build-Jdk-Spec>1.8</Build-Jdk-Spec>
                            <Dependencies>org.json:json</Dependencies>
                        </manifestEntries>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                    <id>make-assembly</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- package javadoc and sources -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.5.0</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.2.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>1.6.13</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>ossrh</serverId>
                    <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>
            <!-- Sign the jar -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jarsigner-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <id>sign</id>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>verify</id>
                        <goals>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <verbose>true</verbose>
                    <certs>true</certs>
                    <keystore>./blumo.jks</keystore>
                    <alias>blumo</alias>
                    <storepass>${signkey.pass}</storepass>
                    <keypass>${signkey.pass}</keypass>
                </configuration>
            </plugin>

            <!-- Sign and Verify artifacts with maven-gpg-plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>1.6</version>
                    <configuration>
                      <gpgArguments>
                        <arg>--pinentry-mode</arg>
                        <arg>loopback</arg>
                      </gpgArguments>
                    </configuration>
                <executions>
                  <execution>
                    <id>sign-artifacts</id>
                    <phase>verify</phase>
                    <goals>
                      <goal>sign</goal>
                    </goals>
                  </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
