<?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">

    <parent>
        <artifactId>crafter-profile-parent</artifactId>
        <groupId>org.craftercms</groupId>
        <version>v2.5.0-Beta4</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.craftercms</groupId>
    <artifactId>crafter-profile-access-token-manager</artifactId>
    <name>Crafter Profile Access Token Manager</name>
    <description>Crafter Profile Access Token Manager</description>
    <url>https://github.com/craftercms/profile/tree/master/access-token-manager</url>
    <packaging>jar</packaging>

    <organization>
        <name>CrafterCMS</name>
        <url>http://craftercms.org</url>
    </organization>
    <licenses>
        <license>
            <name>GNU GENERAL PUBLIC LICENSE, Version 3</name>
            <url>http://www.gnu.org/licenses/gpl-3.0.html</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <developers>
        <developer>
            <id>sumerjabri</id>
            <name>Sumer Jabri</name>
            <email>sumer.jabri@craftercms.org</email>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/craftercms/profile/tree/master/api</connection>
        <developerConnection>scm:git:git://github.com/craftercms/profile/tree/master/api</developerConnection>
        <url>scm:git:git://github.com/craftercms/profile/tree/master/api</url>
    </scm>

    <properties>
        <apache.commons.cli.version>1.2</apache.commons.cli.version>
    </properties>

    <dependencies>
        <!-- Crafter -->
        <dependency>
            <groupId>org.craftercms</groupId>
            <artifactId>crafter-commons-utilities</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.craftercms</groupId>
            <artifactId>crafter-commons-mongo</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.craftercms</groupId>
            <artifactId>crafter-profile-api</artifactId>
            <version>${project.version}</version>
        </dependency>

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

        <!-- Jackson -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>${jackson.version}</version>
        </dependency>

        <!-- Commons -->
        <dependency>
            <groupId>commons-cli</groupId>
            <artifactId>commons-cli</artifactId>
            <version>${apache.commons.cli.version}</version>
        </dependency>

        <!-- Spring -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${spring.version}</version>
            <exclusions>
                <!-- Exclude Commons Logging in favor of SLF4j -->
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <version>${spring.version}</version>
            <exclusions>
                <!-- Exclude Commons Logging in favor of SLF4j -->
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- Logging -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>${slf4j.version}</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback.version}</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-core</artifactId>
            <version>${logback.version}</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                        <manifestEntries>
                            <Implementation-Build>${buildNumber}</Implementation-Build>
                            <Build-On>${timestamp}</Build-On>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>default</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <resources>
                    <resource>
                        <directory>src/main/resources</directory>
                        <!-- Exclude CLI related resources, since they're only needed by the executable jar -->
                        <excludes>
                            <exclude>access-token-manager-cli.properties</exclude>
                            <exclude>access-token-manager-cli-context.xml</exclude>
                            <exclude>access-token-manager-queries.xml</exclude>
                            <exclude>logback.xml</exclude>
                        </excludes>
                    </resource>
                </resources>
            </build>
        </profile>
        <profile>
            <id>executableJar</id>
            <build>
                <finalName>access-token-manager</finalName>
                <plugins>
                    <plugin>
                        <artifactId>maven-shade-plugin</artifactId>
                        <version>2.2</version>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>shade</goal>
                                </goals>
                                <configuration>
                                    <transformers>
                                        <transformer
                                                implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                            <mainClass>org.craftercms.profile.utils.AccessTokenManagerCli</mainClass>
                                        </transformer>
                                    </transformers>
                                    <artifactSet>
                                        <excludes>
                                            <exclude>org.aspectj:*</exclude>
                                            <exclude>ch.qos.cal10n:*</exclude>
                                        </excludes>
                                    </artifactSet>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>