<?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>
    <groupId>com.flowlogix</groupId>
    <artifactId>flowlogix-jee</artifactId>
    <version>5.4</version>
    <packaging>jar</packaging>

    <name>Flow Logix JEE Services</name>
    <description>Flow Logix Utility Library for JavaEE</description>
    <url>http://code.google.com/p/flowlogix</url>

    <parent>
        <groupId>com.flowlogix</groupId>
        <artifactId>jakarta-ee</artifactId>
        <version>5.4</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>

        <dependency>
            <groupId>org.jboss.shrinkwrap</groupId>
            <artifactId>shrinkwrap-api</artifactId>
            <version>1.2.6</version>
            <scope>provided</scope>
            <optional>true</optional>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>jakarta</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>target/replacer</outputDirectory>
                            <overwrite>true</overwrite>
                            <resources>
                                <resource>
                                    <directory>target/classes/META-INF</directory>
                                    <includes>
                                        <include>web-fragment.xml</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>io.github.floverfelt</groupId>
                <artifactId>find-and-replace-maven-plugin</artifactId>
                <version>1.1.0</version>
                <configuration>
                    <replacementType>file-contents</replacementType>
                    <baseDir>target/replacer/</baseDir>
                    <recursive>false</recursive>
                    <fileMask>.xml</fileMask>
                </configuration>
                <executions>
                    <execution>
                        <id>jakarta-project-stage-ref</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>find-and-replace</goal>
                        </goals>
                        <configuration>
                            <findRegex>jsf/ProjectStage</findRegex>
                            <replaceValue>faces/ProjectStage</replaceValue>
                        </configuration>
                    </execution>
                    <execution>
                        <id>jakarta-project-stage-param</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>find-and-replace</goal>
                        </goals>
                        <configuration>
                            <findRegex>javax.faces</findRegex>
                            <replaceValue>jakarta.faces</replaceValue>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-shade-plugin</artifactId>
                <configuration>
                    <filters combine.children="append">
                        <filter>
                            <artifact>${project.groupId}:${project.artifactId}</artifact>
                            <excludes>
                                <exclude>META-INF/web-fragment.xml</exclude>
                            </excludes>
                        </filter>
                    </filters>
                    <transformers combine.children="append">
                        <transformer implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
                            <resource>META-INF/web-fragment.xml</resource>
                            <file>target/replacer/web-fragment.xml</file>
                        </transformer>
                    </transformers>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
