<?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>
    <packaging>maven-plugin</packaging>

    <groupId>io.github.kpihlblad</groupId>
    <artifactId>kumuluzee-maven-plugin</artifactId>
    <version>4.1.0</version>

    <name>KumuluzEE Maven Plugin temporary fix</name>
    <description>KumuluzEE maven plugin for building single uber jars</description>

    <properties>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <kumuluzee.plugin.test.skip>false</kumuluzee.plugin.test.skip>
        <kumuluzee.version>4.1.0</kumuluzee.version>
    </properties>

    <developers>
        <developer>
            <id>kumuluz</id>
            <name>KumuluzEE Development Team</name>
            <email>info@kumuluz.com</email>
            <url>https://github.com/kumuluz</url>
        </developer>
        <developer>
            <id>karlp</id>
            <name>Karl Pihlblad</name>
            <url>https://github.com/kpihlblad/kmlz-maven-plugin</url>
        </developer>

    </developers>


    <licenses>
        <license>
            <name>MIT License</name>
            <url>http://www.opensource.org/licenses/mit-license.php</url>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:git@github.com:kpihlblad/kmlz-maven-plugin.git</connection>
        <developerConnection>scm:git:git@github.com:kpihlblad/kmlz-maven-plugin.git</developerConnection>
        <url>git@github.com:kpihlblad/kmlz-maven-plugin.git</url>
    </scm>

    <url>https://github.com/kpihlblad/kmlz-maven-plugin</url>

    <issueManagement>
        <system>GitHub Issues</system>
        <url>https://github.com/kpihlblad/kmlz-maven-plugin/issues</url>
    </issueManagement>


    <dependencies>
        <dependency>
            <groupId>com.kumuluz.ee</groupId>
            <artifactId>kumuluzee-loader</artifactId>
            <version>${kumuluzee.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>3.8.5</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.plugin-tools</groupId>
            <artifactId>maven-plugin-annotations</artifactId>
            <version>3.6.4</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.twdata.maven</groupId>
            <artifactId>mojo-executor</artifactId>
            <version>2.3.2</version>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.12.7.1</version>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.6</version>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>${project.build.directory}/generated-resources/loader</directory>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.1.2</version>
                <executions>
                    <execution>
                        <id>include-loader</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <skip>${kumuluzee.plugin.test.skip}</skip>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.kumuluz.ee</groupId>
                                    <artifactId>kumuluzee-loader</artifactId>
                                    <version>${kumuluzee.version}</version>
                                    <destFileName>kumuluzee-loader.jar</destFileName>
                                </artifactItem>
                            </artifactItems>
                            <outputDirectory>${project.build.directory}/generated-resources/loader/META-INF/loader
                            </outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <version>3.6.0</version>
                <configuration>
                    <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
                </configuration>
                <executions>
                    <execution>
                        <id>mojo-descriptor</id>
                        <goals>
                            <goal>descriptor</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>help-goal</id>
                        <goals>
                            <goal>helpmojo</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>


    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.4.1</version>
                        <executions>
                            <execution>
                                <id>attach-javadoc</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-source</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.jreleaser</groupId>
                        <artifactId>jreleaser-maven-plugin</artifactId>
                        <version>1.3.1</version>
                        <configuration>
                            <jreleaser>
                                <signing>
                                    <active>ALWAYS</active>
                                    <armored>true</armored>
                                </signing>
                                <deploy>
                                    <maven>
                                        <nexus2>
                                            <maven-central>
                                                <active>ALWAYS</active>
                                                <url>https://s01.oss.sonatype.org/service/local</url>;
                                                <closeRepository>true</closeRepository>
                                                <releaseRepository>true</releaseRepository>
                                                <stagingRepositories>target/staging-deploy</stagingRepositories>
                                            </maven-central>
                                        </nexus2>
                                    </maven>
                                </deploy>
                            </jreleaser>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>