<?xml version="1.0" encoding="UTF-8"?>
<!--
 ~  Copyright 2017 Red Hat, Inc.
 ~
 ~  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>

    <parent>
        <groupId>io.thorntail</groupId>
        <artifactId>microprofile-config-wildfly</artifactId>
        <version>1.7.1.redhat-00008</version>
    </parent>

    <artifactId>microprofile-config-wildfly-dist</artifactId>
    <name>WildFly: MicroProfile Config Distribution</name>
    <packaging>jar</packaging>

    <properties>
        <server.output.dir.prefix>microprofile-config</server.output.dir.prefix>
    </properties>
    <dependencies>
        <dependency>
            <groupId>io.thorntail</groupId>
            <artifactId>microprofile-config-wildfly-feature-pack</artifactId>
            <type>pom</type>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.thorntail</groupId>
            <artifactId>microprofile-config-wildfly-feature-pack</artifactId>
            <type>zip</type>
            <exclusions>
                <exclusion>
                    <groupId>*</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.wildfly</groupId>
            <artifactId>wildfly-feature-pack</artifactId>
            <type>zip</type>
        </dependency>
    </dependencies>

    <build>
        <finalName>microprofile-config-${project.version}</finalName>
        <plugins>
            <plugin>
                <groupId>org.wildfly.build</groupId>
                <artifactId>wildfly-server-provisioning-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>server-provisioning</id>
                        <goals>
                            <goal>build</goal>
                        </goals>
                        <phase>compile</phase>
                        <configuration>
                            <config-file>server-provisioning.xml</config-file>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>distribution-configuration</id>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <phase>process-classes</phase>
                        <configuration>
                            <overwrite>true</overwrite>
                            <outputDirectory>${basedir}/target/${server.output.dir.prefix}-${project.version}</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/distribution/resources</directory>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <id>assemble</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>assembly.xml</descriptor>
                            </descriptors>
                            <recompressZippedFiles>true</recompressZippedFiles>
                            <finalName>${server.output.dir.prefix}-${project.version}</finalName>
                            <appendAssemblyId>false</appendAssemblyId>
                            <outputDirectory>${project.build.directory}</outputDirectory>
                            <workDirectory>${project.build.directory}/assembly/work</workDirectory>
                            <tarLongFileMode>posix</tarLongFileMode>
                        </configuration>
                    </execution>
                    <execution>
                        <id>assemble-src</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>assembly-src.xml</descriptor>
                            </descriptors>
                            <finalName>${server.output.dir.prefix}-${project.version}</finalName>
                            <appendAssemblyId>true</appendAssemblyId>
                            <outputDirectory>${project.build.directory}</outputDirectory>
                            <workDirectory>${project.build.directory}/assembly-src/work</workDirectory>
                            <tarLongFileMode>posix</tarLongFileMode>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
