<?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>ru.kirillius</groupId>
        <artifactId>pf-sdn</artifactId>
        <version>1.0.1.5</version>
    </parent>

    <artifactId>pf-sdn.ovpn-connector</artifactId>



    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>1.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <filters>
                        <filter>
                            <artifact>*:*</artifact>
                            <excludes>
                                <exclude>module-info.class</exclude>
                                <exclude>JDOMAbout*class</exclude>
                                <exclude>META-INF/*.SF</exclude>
                                <exclude>META-INF/*.DSA</exclude>
                                <exclude>META-INF/*.RSA</exclude>
                            </excludes>
                        </filter>
                    </filters>
                    <transformers>
                        <transformer
                                implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                            <manifestEntries>
                                <Main-Class>ru.kirillius.pf.sdn.External.API.ovpn.connector.App</Main-Class>
                            </manifestEntries>
                        </transformer>
                    </transformers>
                    <shadedArtifactAttached>true
                    </shadedArtifactAttached> <!-- Make the shaded artifact not the main one -->
                    <shadedClassifierName>shaded</shadedClassifierName> <!-- set the suffix to the shaded jar -->
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>3.1.0</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <delete file="target/ovpn-pfsdn-bind"/>
                                <concat destfile="target/ovpn-pfsdn-bind" binary="true">
                                <fileset file="../unix-wrapper.sh"/>
                                <fileset file="target/pf-sdn.ovpn-connector-${project.version}-shaded.jar"/>
                                </concat>
                                <chmod file="target/ovpn-pfsdn-bind" perm="755"/>
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>

</project>