<?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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <artifactId>javascript-console-share</artifactId>
    <name>JavaScript Console - Share</name>
    <description>Alfresco Share-Extras JavaScript Console - Share Module</description>
    <packaging>amp</packaging>

    <parent>
        <groupId>de.fmaul</groupId>
        <artifactId>javascript-console</artifactId>
        <version>0.6</version>
    </parent>

    <!--
       | SDK properties have sensible defaults in the SDK parent,
       | but you can override the properties below to use another version.
       | For more available properties see the alfresco-sdk-parent POM.
       -->
    <properties>
        <!-- Defines the target WAR artifactId to run this amp, only used with the -Pamp-to-war switch
        | Allowed values: alfresco | share. In this case it's configured to use OOTB share -->
        <alfresco.client.war>${alfresco.share.artifactId}</alfresco.client.war>
        <alfresco.client.contextPath>/share</alfresco.client.contextPath>
        <!-- Since Alfresco is already running on port 8080, we run Share on port 8081 -->
        <maven.tomcat.port>9080</maven.tomcat.port>

        <!-- Used in share-config-custom.xml. By default points to standard location of Alfresco -->
        <alfresco.repo.url>http://localhost:8080/alfresco</alfresco.repo.url>

        <!-- Defines the Alfresco version to work against.
             Community versions are typically identified by major.minor.character (4.2.a),
             while Enterprise versions are identified by major.minor.digit (4.2.0)
        -->
        <!--<alfresco.version>5.0.c</alfresco.version>-->

        <!-- Defines the log level used in log4j.properties -->
        <app.log.root.level>WARN</app.log.root.level>

        <!-- The Maven artifact ID to use when loading the Share.WAR that the AMP should be applied to,
                    defaults to the alfresco.war artifact ID, so we need to override here. -->
        <app.amp.client.war.artifactId>${alfresco.share.artifactId}</app.amp.client.war.artifactId>

    </properties>

    <!-- Here we realize the connection with the Alfresco selected platform
        (e.g.version and edition) -->
    <dependencyManagement>
        <dependencies>
            <!-- This will import the dependencyManagement for all artifacts in the selected Alfresco version/edition
                (see http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Importing_Dependencies)
                NOTE: You still need to define dependencies in your POM, but you can omit version as it's enforced by this dependencyManagement. NOTE: It defaults
                to the latest version this SDK pom has been tested with, but alfresco version can/should be overridden in your project's pom -->
            <dependency>
                <groupId>${alfresco.groupId}</groupId>
                <artifactId>alfresco-platform-distribution</artifactId>
                <version>${alfresco.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <!-- Following dependencies are needed for compiling Java code in src/main/java;  -->
    <dependencies>
        <dependency>
            <groupId>${alfresco.groupId}</groupId>
            <artifactId>share</artifactId>
            <version>${alfresco.version}</version>
            <classifier>classes</classifier>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.extensions.surf</groupId>
            <artifactId>spring-surf-api</artifactId>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>

            <!-- Compress JavaScript files and store as *-min.js -->

            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <configuration>
                    <nonFilteredFileExtensions>
                        <nonFilteredFileExtension>js</nonFilteredFileExtension>
                        <nonFilteredFileExtension>css</nonFilteredFileExtension>
                        <nonFilteredFileExtension>ftl</nonFilteredFileExtension>

                    </nonFilteredFileExtensions>
                </configuration>
            </plugin>

        </plugins>
    </build>

    <profiles>

        <!-- Enterprise profile, manually activated, automatically adds support for Enterprise edition development (dependencies) -->
        <profile>
            <id>enterprise</id>
            <dependencies>
                <dependency>
                    <groupId>${alfresco.groupId}</groupId>
                    <artifactId>share-enterprise</artifactId>
                    <version>${alfresco.version}</version>
                    <classifier>classes</classifier>
                    <scope>provided</scope>
                </dependency>
            </dependencies>
        </profile>

        <profile>
            <id>installable-jar</id>
            <build>
                <plugins>
                    <!-- Build alternative artifacts (installable JAR, overlay WAR) -->
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <version>2.4</version>
                        <configuration>
                            <appendAssemblyId>false</appendAssemblyId>
                            <attach>false</attach>
                        </configuration>
                        <executions>
                            <execution>
                                <id>make-installable-jar</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <classifier>installable</classifier>
                                    <finalName>${project.build.finalName}-installable</finalName>
                                    <descriptor>src/main/assembly/installable-jar.xml</descriptor>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Attach alternative artifacts -->
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <version>1.8</version>
                        <executions>
                            <execution>
                                <id>attach-artifacts</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>attach-artifact</goal>
                                </goals>
                                <configuration>
                                    <artifacts>
                                        <artifact>
                                            <file>${project.build.directory}/${project.build.finalName}-installable.jar</file>
                                            <type>jar</type>
                                            <classifier>installable</classifier>
                                        </artifact>
                                    </artifacts>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

    </profiles>

</project>
