<?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>openapi-ext</artifactId>
        <version>2.0.0</version>
    </parent>
    
    <groupId>org.microprofile-ext.openapi-ext</groupId>
    <artifactId>openapi-ui</artifactId>
    <packaging>jar</packaging>
    
    <name>Microprofile OpenApi Extensions :: OpenApi UI</name>
    <description>A (swagger) UI for MicroProfile Open API</description>
    
    <properties>
        <swagger-ui.version>4.14.2</swagger-ui.version>
        <swagger.ui.themes.version>3.0.0</swagger.ui.themes.version>
    </properties>
    
    <dependencies>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>5.3.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
            <version>5.3.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>5.3.1</version>
            <scope>test</scope>
        </dependency>
        
    </dependencies>
    
    <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>
            <!-- This will get the fat webjar and extract only the part we care about -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.1.1</version>
                <configuration>
                    <artifactItems>
                        <artifactItem>
                            <groupId>org.webjars</groupId>
                            <artifactId>swagger-ui</artifactId>
                            <version>${swagger-ui.version}</version>
                            <type>jar</type>
                            <overWrite>true</overWrite>
                            <outputDirectory>${project.build.directory}/classes</outputDirectory>
                        </artifactItem>
                        <artifactItem>
                            <groupId>org.webjars.bower</groupId>
                            <artifactId>swagger-ui-themes</artifactId>
                            <version>${swagger.ui.themes.version}</version>
                            <type>jar</type>
                            <overWrite>true</overWrite>
                            <outputDirectory>${project.build.directory}/classes</outputDirectory>
                        </artifactItem>
                    </artifactItems>
                    <excludes>**/screenshots/**,**/themes/2.x/**,**/README.md,**/bower.json,**/package.json,**/*.gz, META-INF/maven/**,**/index.html,**/favicon*.png</excludes>
                    <encoding>UTF-8</encoding>
                </configuration>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    
</project>
