<?xml version="1.0" encoding="UTF-8"?>
<!-- vi: set ts=4:sw=4:expandtab: -->
<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/maven-v4_0_0.xsd">

    <!-- Parent -->
    <parent>
        <groupId>org.jboss.shrinkwrap.resolver</groupId>
        <artifactId>shrinkwrap-resolver-parent</artifactId>
        <version>3.1.4</version>
        <relativePath>../../pom.xml</relativePath>
    </parent>

    <!-- Model Version -->
    <modelVersion>4.0.0</modelVersion>

    <!-- Artifact Configuration -->
    <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
    <name>ShrinkWrap Resolver Maven Implementation</name>
    <description>Implementation for Resolving Dependencies from a Maven Backend</description>

    <!-- Properties -->
    <properties>
        <!-- Test JAR archive -->
        <appended.jar.for.test>${basedir}/target/additional-test.jar</appended.jar.for.test>
    </properties>


    <!-- Dependencies -->
    <dependencies>

        <!-- org.jboss.shrinkwrap -->
        <dependency>
            <groupId>org.jboss.shrinkwrap.resolver</groupId>
            <artifactId>shrinkwrap-resolver-api-maven</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.shrinkwrap.resolver</groupId>
            <artifactId>shrinkwrap-resolver-spi-maven</artifactId>
            <version>${project.version}</version>
        </dependency>

        <!-- External Projects -->

        <!-- org.apache.maven -->
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-resolver-provider</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-model</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-model-builder</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-repository-metadata</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-settings</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-settings-builder</artifactId>
        </dependency>

        <!-- maven resolver -->
        <dependency>
            <groupId>org.apache.maven.resolver</groupId>
            <artifactId>maven-resolver-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.resolver</groupId>
            <artifactId>maven-resolver-impl</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.resolver</groupId>
            <artifactId>maven-resolver-spi</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.resolver</groupId>
            <artifactId>maven-resolver-util</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.resolver</groupId>
            <artifactId>maven-resolver-connector-basic</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.resolver</groupId>
            <artifactId>maven-resolver-transport-wagon</artifactId>
        </dependency>

        <!-- org.codehaus.plexus -->
        <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-interpolation</artifactId>
            <scope>runtime</scope>
        </dependency>
        <!-- plexus utils are needed in order to parse maven plugin configuration -->
        <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-utils</artifactId>
        </dependency>
        <!-- plexus sec dispatcher is needed to support encrypted passwords -->
        <dependency>
            <groupId>org.sonatype.plexus</groupId>
            <artifactId>plexus-sec-dispatcher</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.codehaus.plexus</groupId>
                    <artifactId>plexus-utils</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- org.apache.maven.wagon -->
        <dependency>
            <groupId>org.apache.maven.wagon</groupId>
            <artifactId>wagon-provider-api</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.codehaus.plexus</groupId>
                    <artifactId>plexus-utils</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.wagon</groupId>
            <artifactId>wagon-file</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.wagon</groupId>
            <artifactId>wagon-http-lightweight</artifactId>
            <version>${version.org.apache.maven.wagon}</version>
        </dependency>

        <!-- Test dependencies -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-webapp</artifactId>
            <version>${version.org.eclipse.jetty}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>${version.mockito-all}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.github.stefanbirkner</groupId>
            <artifactId>system-rules</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- we need this artifact to test resolution from classpath -->
        <dependency>
            <groupId>org.jboss.shrinkwrap.resolver</groupId>
            <artifactId>shrinkwrap-resolver-api-maven</artifactId>
            <version>${project.version}</version>
            <type>test-jar</type>
            <classifier>tests</classifier>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <!-- Build Configuration -->
    <build>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
                <filtering>true</filtering>
            </testResource>
        </testResources>

        <plugins>
            <!-- we are creating additional jar to test loading resources from classpath -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>create-additional-jar</id>
                        <phase>generate-test-resources</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <copy todir="${basedir}/target/additional-test-jar">
                                    <fileset dir="${basedir}/src/test/resources">
                                        <include name="**/settings3.xml" />
                                        <include name="**/test-parent.xml" />
                                    </fileset>
                                    <filterset begintoken="${" endtoken="}">
                                        <filter token="basedir" value="${basedir}" />
                                    </filterset>
                                    <mapper>
                                        <chainedmapper>
                                            <globmapper from="*.xml" to="*-from-classpath.xml" casesensitive="no" />
                                        </chainedmapper>
                                    </mapper>
                                </copy>
                                <jar destfile="${basedir}/target/additional-test.jar" basedir="${basedir}/target/additional-test-jar" />
                            </target>
                        </configuration>
                    </execution>
                    <execution>
                        <!-- We need to duplicate all maven-metadata-local.xml with the new name maven-metadata.xml,
                             so we can use the repository as remote (otherwise for example version range resolution
                             will fail, because of missing maven-metadata.xml file) -->
                        <id>create-nonlocal-maven-metadata</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <copy todir="${basedir}/target/repository">
                                    <fileset dir="${basedir}/target/repository">
                                        <include name="**/maven-metadata-local.xml" />
                                    </fileset>
                                    <mapper>
                                        <chainedmapper>
                                            <globmapper from="*maven-metadata-local.xml" to="*maven-metadata.xml" casesensitive="no" />
                                        </chainedmapper>
                                    </mapper>
                                </copy>
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <additionalClasspathElements>
                        <additionalClasspathElement>${appended.jar.for.test}</additionalClasspathElement>
                    </additionalClasspathElements>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enforce-files-exist</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireFilesExist>
                                    <files>
                                        <file>${appended.jar.for.test}</file>
                                    </files>
                                </requireFilesExist>
                            </rules>
                            <fail>true</fail>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <!-- Specified version because 2.7 is affected by this bug in filtering plugin
                     https://issues.apache.org/jira/browse/MSHARED-325 -->
                <version>2.6</version>
                <executions>
                    <execution>
                        <id>default-testResources</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>testResources</goal>
                        </goals>
                        <configuration>
                            <nonFilteredFileExtensions>
                                <nonFilteredFileExtension>jar</nonFilteredFileExtension>
                            </nonFilteredFileExtensions>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-repository</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/repository</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${basedir}/src/test/resources/repository</directory>
                                    <filtering>false</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-settings</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/settings/profiles</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${basedir}/src/test/resources/profiles</directory>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                            <escapeString>\</escapeString>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-poms</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/poms</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${basedir}/src/test/resources/poms</directory>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-shade-plugin</artifactId>
                <version>${version.maven.shade.plugin}</version>
                <configuration>
                    <createDependencyReducedPom>false</createDependencyReducedPom>
                    <shadedArtifactAttached>true</shadedArtifactAttached>
                    <shadedClassifierName>shaded</shadedClassifierName>
                    <filters>
                        <filter>
                            <artifact>*:*</artifact>
                            <excludes>
                                <exclude>META-INF/*.SF</exclude>
                                <exclude>META-INF/*.DSA</exclude>
                                <exclude>META-INF/*.RSA</exclude>
                            </excludes>
                        </filter>
                    </filters>
                    <relocations>
                        <relocation>
                            <pattern>org.sonatype.</pattern>
                            <shadedPattern>shaded.org.sonatype.</shadedPattern>
                        </relocation>
                        <relocation>
                        <pattern>org.jsoup.</pattern>
                            <shadedPattern>shaded.org.jsoup.</shadedPattern>
                        </relocation>
                        <relocation>
                            <pattern>org.jboss.</pattern>
                            <shadedPattern>shaded.org.jboss.</shadedPattern>
                        </relocation>
                        <relocation>
                            <pattern>org.eclipse.</pattern>
                            <shadedPattern>shaded.org.eclipse.</shadedPattern>
                        </relocation>
                        <relocation>
                            <pattern>org.codehaus.</pattern>
                            <shadedPattern>shaded.org.codehaus.</shadedPattern>
                        </relocation>
                        <relocation>
                            <pattern>org.apache.</pattern>
                            <shadedPattern>shaded.org.apache.</shadedPattern>
                        </relocation>
                        <relocation>
                            <pattern>com.google.</pattern>
                            <shadedPattern>shaded.com.google.</shadedPattern>
                        </relocation>
                        <relocation>
                            <pattern>javax.inject.</pattern>
                            <shadedPattern>shaded.javax.inject.</shadedPattern>
                        </relocation>
                        <relocation>
                            <pattern>org.slf4j.</pattern>
                            <shadedPattern>shaded.org.slf4j.</shadedPattern>
                        </relocation>
                    </relocations>
                    <transformers>
                        <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
                    </transformers>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

