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

    <parent>
        <groupId>net.pricefx</groupId>
        <artifactId>pricefx-packaging</artifactId>
        <version>3.26.1</version>
    </parent>

    <artifactId>pricefx-pckg</artifactId>
    <name>${project.artifactId}</name>
    <description>PriceFx packaging tool</description>
    <url>https://gitlab.pricefx.eu/tools/pfxpackage</url>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Richard Matula</name>
            <email>richard.matula@pricefx.com</email>
            <organization>PriceFx</organization>
            <organizationUrl>http://www.pricefx.com</organizationUrl>
        </developer>
    </developers>

    <scm>
        <url>https://gitlab.pricefx.eu/tools/pfxpackage</url>
        <connection>scm:git:git@gitlab.pricefx.eu:tools/pfxpackage.git</connection>
        <developerConnection>scm:git:git@gitlab.pricefx.eu:tools/pfxpackage.git</developerConnection>
        <tag>pricefx-packaging-${version}</tag>
    </scm>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.2.0</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- Attach javadocs jar -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.2.0</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- Sign artifacts for uploading to maven central -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>3.0.1</version>
                <executions>
                    <execution>
                        <id>sign-artifacts</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>appassembler-maven-plugin</artifactId>
                <version>1.10</version>
                <executions>
                    <execution>
                        <id>appassembler</id>
                        <phase>package</phase>
                        <goals>
                            <goal>assemble</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <!-- set alternative assemble directory -->
                    <assembleDirectory>${project.build.directory}/distribution</assembleDirectory>
                    <repositoryLayout>flat</repositoryLayout>
                    <logsDirectory>logs</logsDirectory>
                    <tempDirectory>temp</tempDirectory>
                    <programs>
                        <program>
                            <id>pfxpackage</id>
                            <platforms>
                                <platform>windows</platform>
                                <platform>unix</platform>
                            </platforms>
                            <mainClass>net.pricefx.pckg.tool.PackageMain</mainClass>
                        </program>
                    </programs>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>3.2.0</version>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <appendAssemblyId>false</appendAssemblyId>
                            <descriptors>
                                <descriptor>src/main/assembly/assembly.xml</descriptor>
                            </descriptors>
                            <encoding>UTF-8</encoding>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <archive>
                        <index>true</index>
                        <manifest>
                            <addDefaultImplementationEntries>false</addDefaultImplementationEntries>
                            <addDefaultSpecificationEntries>false</addDefaultSpecificationEntries>
                        </manifest>
                        <manifestEntries>
                            <Implementation-Vendor-Id>net.pricefx</Implementation-Vendor-Id>
                            <Implementation-Title>pfxpackage ${project.version}</Implementation-Title>
                            <Implementation-Version>#${env.BUILD_ID} ${env.BUILD_TIMESTAMP}</Implementation-Version>
                            <Build-ID>${env.BUILD_ID}</Build-ID>
                            <git-commit>${env.GIT_COMMIT}</git-commit>
                            <git-branch>${env.GIT_BRANCH}</git-branch>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.1</version>
                <configuration>
                    <useSystemClassLoader>false</useSystemClassLoader>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.11.0</version>
        </dependency>
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>okhttp</artifactId>
        </dependency>
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>logging-interceptor</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </dependency>
        <!-- Jackson -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>
        <!-- Two Factor authentication support -->
        <dependency>
            <groupId>com.j256.two-factor-auth</groupId>
            <artifactId>two-factor-auth</artifactId>
        </dependency>
	    <!-- Tests -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.spockframework</groupId>
            <artifactId>spock-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>mockwebserver</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>without-jenkins</id>
            <activation>
                <property>
                    <name>!env.BUILD_ID</name>
                </property>
            </activation>
            <properties>
                <env.BUILD_ID>unknown</env.BUILD_ID>
                <env.BUILD_TIMESTAMP>unknown</env.BUILD_TIMESTAMP>
                <env.GIT_COMMIT>unknown</env.GIT_COMMIT>
                <env.GIT_BRANCH>unknown</env.GIT_BRANCH>
            </properties>
        </profile>
    </profiles>
</project>
