<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2014-2018 the original author or authors.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<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>
    <groupId>nl.devillers</groupId>
    <artifactId>spring-boot-admin-hystrix-dashboard</artifactId>
    <version>1.0.2</version>
    <packaging>jar</packaging>
    <name>Spring Boot Admin 2.x Hystrix Dashboard</name>
    <description>Netflix-Skunkworks/hystrix-dashboard as a Spring Boot Admin 2.x compatible Vue-component</description>
    <url>https://github.com/MartinDevillers/spring-boot-admin-hystrix-dashboard</url>
    <organization>
        <name>Devillers</name>
        <url>https://devillers.nl</url>
    </organization>
    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/MartinDevillers/spring-boot-admin-hystrix-dashboard/issues</url>
    </issueManagement>
    <licenses>
        <license>
            <name>Apache License 2.0</name>
            <url>https://github.com/mautini/schemaorg-java/blob/master/LICENSE</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <developers>
        <developer>
            <name>Martin Devillers</name>
            <email>martin@devillers.nl</email>
            <organization>Devillers</organization>
            <organizationUrl>https://devillers.nl</organizationUrl>
        </developer>
    </developers>
    <scm>
        <connection>scm:git:git://github.com/MartinDevillers/spring-boot-admin-hystrix-dashboard.git</connection>
        <developerConnection>scm:git:ssh://github.com:MartinDevillers/spring-boot-admin-hystrix-dashboard.git</developerConnection>
        <url>http://github.com/MartinDevillers/spring-boot-admin-hystrix-dashboard/tree/master</url>
    </scm>
    <properties>
        <project.version>1.0</project.version>
        <skipNpmBuild>false</skipNpmBuild>
    </properties>
    <repositories>
        <repository>
            <id>central</id>
            <name>Central Repository</name>
            <url>https://repo.maven.apache.org/maven2</url>
            <layout>default</layout>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
            <groupId>com.netflix.hystrix</groupId>
            <artifactId>hystrix-dashboard</artifactId>
            <version>1.5.18</version>
            <type>war</type>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.1.1</version>
                <executions>
                    <execution>
                        <id>unpack-hystrix-dashboard</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <includeArtifactIds>hystrix-dashboard</includeArtifactIds>
                            <outputDirectory>${project.build.directory}/classes/META-INF/spring-boot-admin-server-ui/hystrix-static</outputDirectory>
                            <excludes>META-INF/**,WEB-INF/**</excludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.google.code.maven-replacer-plugin</groupId>
                <artifactId>replacer</artifactId>
                <version>1.5.3</version>
                <executions>
                    <execution>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>replace</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <file>${project.build.directory}/classes/META-INF/spring-boot-admin-server-ui/hystrix-static/monitor/monitor.html</file>
                    <replacements>
                        <replacement>
                            <token><![CDATA[<div id="header"></div>]]></token>
                            <value></value>
                        </replacement>
                        <replacement>
                            <token>"../proxy.stream?origin="</token>
                            <value>""</value>
                        </replacement>
                    </replacements>
                    <regex>false</regex>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.6.0</version>
                <executions>
                    <execution>
                        <id>npm-install</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>npm</executable>
                            <arguments>
                                <argument>ci</argument>
                            </arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>npm-build</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <skip>${skipNpmBuild}</skip>
                            <executable>npm</executable>
                            <arguments>
                                <argument>run</argument>
                                <argument>build</argument>
                            </arguments>
                            <environmentVariables>
                                <PROJECT_VERSION>${project.version}</PROJECT_VERSION>
                            </environmentVariables>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>target/dist</directory>
                <targetPath>META-INF/spring-boot-admin-server-ui/extensions/hystrix-dashboard</targetPath>
                <filtering>false</filtering>
            </resource>
        </resources>
    </build>
    <profiles>
        <profile>
            <id>release</id>
            <distributionManagement>
                <snapshotRepository>
                    <id>ossrh</id>
                    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
                </snapshotRepository>
                <repository>
                    <id>ossrh</id>
                    <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
                </repository>
            </distributionManagement>    
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-jar-plugin</artifactId>
                        <version>3.2.0</version>
                        <executions>
                            <execution>
                                <id>default-jar</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>javadoc-jar</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                                <configuration>
                                    <classifier>javadoc</classifier>
                                </configuration>
                            </execution>
                            <execution>
                                <id>sources-jar</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                                <configuration>
                                    <classifier>sources</classifier>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
