<?xml version="1.0" encoding="UTF-8"?>
<!--

  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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.ops4j.pax</groupId>
        <artifactId>url</artifactId>
        <version>2.6.16</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <groupId>org.ops4j.pax.url</groupId>
    <artifactId>pax-url-aether</artifactId>
    <packaging>bundle</packaging>

    <name>OPS4J Pax Url - mvn:</name>
    <description>OPS4J Pax Url - mvn: protocol handler</description>

    <properties>
        <bundle.symbolicName>org.ops4j.pax.url.mvn</bundle.symbolicName>
        <bundle.namespace>org.ops4j.pax.url.mvn</bundle.namespace>
        <TEST_REPO>file:${project.build.directory}/remote-repo</TEST_REPO>
    </properties>

    <dependencies>

        <dependency>
            <groupId>org.ops4j.pax.url</groupId>
            <artifactId>pax-url-aether-support</artifactId>
        </dependency>
        <dependency>
            <groupId>org.ops4j.pax.url</groupId>
            <artifactId>pax-url-commons</artifactId>
            <optional>true</optional>
        </dependency>

        <!-- Embeded dependencies (not transitive) -->

        <dependency>
            <groupId>org.ops4j.base</groupId>
            <artifactId>ops4j-base-lang</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.ops4j.base</groupId>
            <artifactId>ops4j-base-io</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.ops4j.base</groupId>
            <artifactId>ops4j-base-net</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.ops4j.base</groupId>
            <artifactId>ops4j-base-util-property</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.ops4j.base</groupId>
            <artifactId>ops4j-base-util-xml</artifactId>
            <optional>true</optional>
        </dependency>

        <!-- Provided dependencies (not transitive) -->

        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>osgi.core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>osgi.cmpn</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.annotation</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Logging (not embedded) -->

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- mvn stuff -->

        <dependency>
            <groupId>org.apache.maven.resolver</groupId>
            <artifactId>maven-resolver-api</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.resolver</groupId>
            <artifactId>maven-resolver-spi</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.resolver</groupId>
            <artifactId>maven-resolver-util</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.resolver</groupId>
            <artifactId>maven-resolver-impl</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.resolver</groupId>
            <artifactId>maven-resolver-connector-basic</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.resolver</groupId>
            <artifactId>maven-resolver-transport-wagon</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-resolver-provider</artifactId>
            <optional>true</optional>
            <exclusions>
                <exclusion>
                    <groupId>javax.inject</groupId>
                    <artifactId>javax.inject</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-settings-builder</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-sec-dispatcher</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.sonatype.plexus</groupId>
                    <artifactId>plexus-cipher</artifactId>
                </exclusion>
            </exclusions>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-cipher</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-utils</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.wagon</groupId>
            <artifactId>wagon-provider-api</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.wagon</groupId>
            <artifactId>wagon-file</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.wagon</groupId>
            <artifactId>wagon-http</artifactId>
            <optional>true</optional>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.httpcomponents</groupId>
                    <artifactId>httpclients</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.jsoup</groupId>
                    <artifactId>jsoup</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>nekohtml</groupId>
                    <artifactId>nekohtml</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>nekohtml</groupId>
                    <artifactId>xercesMinimal</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- Test dependencies -->

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.easymock</groupId>
            <artifactId>easymock</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.objenesis</groupId>
                    <artifactId>objenesis</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-api-easymock</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-module-junit4</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- Emulate amazon s3 -->

        <dependency>
            <groupId>org.eclipse.jetty.aggregate</groupId>
            <artifactId>jetty-server</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty.aggregate</groupId>
            <artifactId>jetty-plus</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- Invoke maven goals -->

        <dependency>
            <groupId>org.apache.maven.shared</groupId>
            <artifactId>maven-invoker</artifactId>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
                <filtering>true</filtering>
                <excludes>
                    <exclude>repo2/**</exclude>
                    <exclude>repo3/**</exclude>
                    <exclude>repomulti/**</exclude>
                    <exclude>repomulti_with_file/**</exclude>
                </excludes>
            </testResource>
            <testResource>
                <directory>src/test/resources</directory>
                <filtering>false</filtering>
                <includes>
                    <include>repo2/**</include>
                    <include>repo3/**</include>
                    <include>repomulti/**</include>
                    <include>repomulti_with_file/**</include>
                </includes>
            </testResource>
        </testResources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <artifactSet>
                                <includes>
                                    <include>null:null</include>
                                </includes>
                            </artifactSet>
                            <relocations>
                                <relocation>
                                    <shadedPattern>shaded.</shadedPattern>
                                    <includes>
                                        <include>org.apache.commons.codec.**</include>
                                        <include>org.apache.commons.lang3.**</include>
                                        <include>org.apache.commons.io.**</include>
                                        <include>org.apache.commons.logging.**</include>
                                        <include>org.apache.http.**</include>
                                        <include>org.apache.maven.**</include>
                                        <include>org.codehaus.plexus.**</include>
                                        <include>org.eclipse.aether.**</include>
                                        <include>org.ops4j.io.**</include>
                                        <include>org.ops4j.lang.**</include>
                                        <include>org.ops4j.net.**</include>
                                        <include>org.ops4j.pax.swissbox.**</include>
                                        <include>org.ops4j.util.**</include>
                                        <include>org.ops4j.monitors.**</include>
                                        <include>org.sonatype.plexus.**</include>
                                    </includes>
                                </relocation>
                            </relocations>
                            <filters>
                                <filter>
                                    <artifact>*:*</artifact>
                                    <excludes>
                                        <exclude>org/apache/commons/codec/language/**</exclude>
                                        <exclude>org/apache/commons/lang3/arch/**</exclude>
                                        <exclude>org/apache/commons/lang3/builder/**</exclude>
                                        <exclude>org/apache/commons/lang3/concurrent/**</exclude>
                                        <exclude>org/apache/commons/lang3/event/**</exclude>
                                        <exclude>org/apache/commons/lang3/exception/**</exclude>
                                        <exclude>org/apache/commons/lang3/math/**</exclude>
                                        <exclude>org/apache/commons/lang3/mutable/**</exclude>
                                        <exclude>org/apache/commons/lang3/reflect/**</exclude>
                                        <exclude>org/apache/commons/lang3/text/**</exclude>
                                        <exclude>org/apache/commons/lang3/time/**</exclude>
                                        <exclude>org/apache/commons/lang3/tuple/**</exclude>
                                    </excludes>
                                </filter>
                            </filters>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <environmentVariables>
                        <NEXUS_ROOT>https://oss.sonatype.org</NEXUS_ROOT>
                    </environmentVariables>
                    <systemPropertyVariables>
                        <jetty.http.port>${jetty.http.port}</jetty.http.port>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>reserve-port</id>
                        <goals>
                            <goal>reserve-network-port</goal>
                        </goals>
                        <phase>validate</phase>
                        <configuration>
                            <portNames>
                                <portName>jetty.http.port</portName>
                            </portNames>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>jdk9+</id>
            <activation>
                <jdk>[9,)</jdk>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <configuration>
                            <compilerArgs>
                                <arg>--add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED</arg>
                            </compilerArgs>
                            <source>11</source>
                            <target>11</target>
                            <testSource>11</testSource>
                            <testTarget>11</testTarget>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
