<?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.app</artifactId>


    <dependencies>
        <dependency>
            <groupId>ru.kirillius</groupId>
            <artifactId>pf-sdn.core</artifactId>
            <version>${project.parent.version}</version>
            <scope>compile</scope>
        </dependency>


        <!-- https://mvnrepository.com/artifact/org.eclipse.jgit/org.eclipse.jgit -->
        <dependency>
            <groupId>org.eclipse.jgit</groupId>
            <artifactId>org.eclipse.jgit</artifactId>
            <version>7.3.0.202506031305-r</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.hierynomus/sshj -->
        <dependency>
            <groupId>com.hierynomus</groupId>
            <artifactId>sshj</artifactId>
            <version>0.40.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-server -->
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-server</artifactId>
            <version>12.0.12</version>
        </dependency>
    </dependencies>

    <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.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.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>3.5.0</version>
                <executions>

                    <execution>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>java</goal>
                        </goals>
                        <configuration>
                            <mainClass>ru.kirillius.json.rpc.CodeGeneration.AutoGenerationUtility</mainClass>
                            <arguments>
                                <argument>--b=${basedir}</argument>
                                <argument>${project.basedir}/../webui/src/json-rpc.js</argument>
                            </arguments>
                        </configuration>
                    </execution>

                    <execution>
                        <id>npm-install</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>npm</executable>
                            <arguments>
                                <argument>install</argument>
                            </arguments>
                            <workingDirectory>${project.basedir}/../webui</workingDirectory>
                        </configuration>
                    </execution>

                    <execution>
                        <id>npm-build</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>npm</executable>
                            <arguments>
                                <argument>run</argument>
                                <argument>build</argument>
                            </arguments>
                            <workingDirectory>${project.basedir}/../webui</workingDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>




        </plugins>
    </build>

</project>