<?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">
    <parent>
        <artifactId>reformcloud2</artifactId>
        <groupId>systems.reformcloud.reformcloud2</groupId>
        <version>2.0</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>reformcloud2-runner</artifactId>

    <build>
        <finalName>runner</finalName>

        <plugins>

            <!-- maven shade plugin (central) -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.1</version>
                <executions>
                    <execution>
                        <!-- shade while package -->
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- maven jar plugin (central) -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.1.2</version>
                <configuration>
                    <archive>
                        <manifestEntries>
                            <Main-Class>systems.reformcloud.reformcloud2.runner.Runner</Main-Class>
                            <Version>${project.version}</Version>
                            <Implementation-Version>${service.version}</Implementation-Version>
                            <Specification-Version>${service.spec}</Specification-Version>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>

            <!-- maven antrun plugin (central) -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.8</version>
                <executions>
                    <execution>
                        <id>copy</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>

                        <!-- Copies the final executor file to the resource directory -->
                        <configuration>
                            <target name="copy executor">
                                <copy file="${basedir}/../reformcloud2-executor/target/executor.jar"
                                      tofile="${basedir}/src/main/resources/files/executor.jar"
                                />
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>