<?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>org.microprofile-ext</groupId>
        <artifactId>health-ext</artifactId>
        <version>1.1.0</version>
    </parent>
    
    <groupId>org.microprofile-ext.health-ext</groupId>
    <artifactId>health-ui</artifactId>
    <packaging>jar</packaging>
    
    <name>Microprofile Health Extensions :: UI</name>
    <description>A basic UI for /health</description>
    
    <properties>
        <bootstrap.version>4.5.0</bootstrap.version>
        <jquery.version>3.5.1</jquery.version>
    </properties>
    
    <build>
                
        <!-- Copy all web content files META-INF folder, and push it though a filter to replace maven properties -->
        <resources>
            <resource>
                <directory>${basedir}/src/main/resources</directory>
            </resource>
            <resource>
                <directory>${basedir}/src/main/webapp</directory>
                <targetPath>${project.build.directory}/classes/META-INF/resources</targetPath>
                <filtering>true</filtering>
                <includes>
                    <include>**/*.css</include>
                    <include>**/*.html</include>
                </includes>
            </resource>
            <resource>
                <directory>${basedir}/src/main/webapp</directory>
                <targetPath>${project.build.directory}/classes/META-INF/resources</targetPath>
                <filtering>false</filtering>
                <excludes>
                    <exclude>**/*.css</exclude>
                    <exclude>**/*.html</exclude>
                </excludes>
            </resource>
        </resources>
        
        <plugins>
            <!-- So we don't have to keep a version of these javascript libs in our repo -->
            <plugin>
                <groupId>com.googlecode.maven-download-plugin</groupId>
                <artifactId>download-maven-plugin</artifactId>
                <version>1.6.0</version>
                <executions>
                    <execution>
                        <id>install-bootstrap-css</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>wget</goal>
                        </goals>
                        <configuration>
                            <url>https://unpkg.com/bootstrap@${bootstrap.version}/dist/css/bootstrap.min.css</url>
                            <unpack>false</unpack>
                            <outputDirectory>${project.build.directory}/classes/META-INF/resources/health-ui</outputDirectory>
                            <md5>3afe15e976734d9daac26310110c4594</md5>
                        </configuration>
                    </execution>
                    <execution>
                        <id>install-bootstrap-js</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>wget</goal>
                        </goals>
                        <configuration>
                            <url>https://unpkg.com/bootstrap@${bootstrap.version}/dist/js/bootstrap.min.js</url>
                            <unpack>false</unpack>
                            <outputDirectory>${project.build.directory}/classes/META-INF/resources/health-ui</outputDirectory>
                            <md5>6bea60c34c5db6797150610dacdc6bce</md5>
                        </configuration>
                    </execution>
                    <execution>
                        <id>install-query</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>wget</goal>
                        </goals>
                        <configuration>
                            <url>https://unpkg.com/jquery@${jquery.version}/dist/jquery.min.js</url>
                            <unpack>false</unpack>
                            <outputDirectory>${project.build.directory}/classes/META-INF/resources/health-ui</outputDirectory>
                            <md5>dc5e7f18c8d36ac1d3d4753a87c98d0a</md5>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    
</project>