<?xml version="1.0" encoding="UTF-8"?>
<!-- vi: set et smarttab sw=4 tabstop=4: -->
<!--
 Copyright (c) 2020 PANTHEON.tech, s.r.o. and others.  All rights reserved.

 This program and the accompanying materials are made available under the
 terms of the Eclipse Public License v1.0 which accompanies this distribution,
 and is available at http://www.eclipse.org/legal/epl-v10.html
-->
<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.opendaylight.aaa</groupId>
        <artifactId>aaa-parent</artifactId>
        <version>0.14.4</version>
        <relativePath>../../parent</relativePath>
    </parent>

    <artifactId>repackaged-shiro</artifactId>
    <packaging>bundle</packaging>
    <name>${project.artifactId}</name>

    <properties>
        <!-- We are just juggling classes here -->
        <odlparent.modernizer.skip>true</odlparent.modernizer.skip>
        <odlparent.spotbugs.skip>true</odlparent.spotbugs.skip>

        <!-- We do not want to generate javadoc -->
        <maven.javadoc.skip>true</maven.javadoc.skip>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.opendaylight.aaa</groupId>
            <artifactId>repackaged-shiro-jar</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>commons-beanutils</groupId>
            <artifactId>commons-beanutils</artifactId>
        </dependency>
        <dependency>
            <groupId>org.owasp.encoder</groupId>
            <artifactId>encoder</artifactId>
            <version>1.2.3</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-license</id>
                        <configuration>
                            <!-- Shiro is Apache-2.0 licensed -->
                            <skip>true</skip>
                        </configuration>
                    </execution>
                    <execution>
                        <id>unpack</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.opendaylight.aaa</groupId>
                                    <artifactId>repackaged-shiro-jar</artifactId>
                                    <version>${project.version}</version>
                                </artifactItem>
                            </artifactItems>
                            <overWriteReleases>false</overWriteReleases>
                            <overWriteSnapshots>true</overWriteSnapshots>
                            <outputDirectory>${project.build.directory}/classes</outputDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>unpack-sources</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <classifier>sources</classifier>
                            <includeArtifactIds>repackaged-shiro-jar</includeArtifactIds>
                            <outputDirectory>${project.build.directory}/shaded-sources</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>shaded-sources</id>
                        <phase>prepare-package</phase>
                        <goals>
                           <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>${project.build.directory}/shaded-sources</sources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>shared-resources</id>
                        <phase>prepare-package</phase>
                        <goals>
                           <goal>add-resource</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>${project.build.directory}/classes/META-INF</directory>
                                    <targetPath>META-INF</targetPath>
                                    <includes>
                                        <include>DEPENDENCIES</include>
                                        <include>LICENSE</include>
                                        <include>NOTICE</include>
                                        <include>shiro.tld</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Include-Resource>
                            {maven-resources},
                            META-INF/git.properties=-${project.build.directory}/classes/META-INF/git.properties,
                            META-INF/services=-${project.build.directory}/classes/META-INF/services
                        </Include-Resource>
                        <Import-Package>
                            javax.servlet.jsp;resolution:=optional,
                            javax.servlet.jsp.tagext;resolution:=optional,
                            org.apache.commons.configuration2.interpol;resolution:=optional,
                            *
                        </Import-Package>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
