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

    <parent>
        <groupId>com.atlassian.confluence</groupId>
        <artifactId>confluence-plugins</artifactId>
        <version>9.2.6</version>
    </parent>

    <groupId>com.atlassian.confluence.plugins</groupId>
    <artifactId>confluence-editor-plugins</artifactId>
    <packaging>pom</packaging>

    <name>Confluence Editor Plugins</name>
    <description>Parent pom for Confluence's editor plugins.</description>

    <modules>
        <!-- Bundled Plugins, in alphabetical order -->
        <module>atlassian-editor</module>
        <module>confluence-editor</module>
        <module>confluence-editor-loader</module>
        <module>confluence-editor-reliable-save</module>
        <module>confluence-image-attributes</module>
        <module>confluence-link-browser</module>
        <module>confluence-macro-browser</module>
        <module>confluence-paste</module>
        <module>confluence-quick-edit</module>
    </modules>

    <properties>
        <atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
        <atlassian.product.version>${project.version}</atlassian.product.version>
        <confluence.data.version>${project.version}</confluence.data.version>
        <confluence.plugin.bundled>true</confluence.plugin.bundled>

        <!-- These properties should be pulled up to the parent pom -->
        <confluence.version>${project.version}</confluence.version>
    </properties>
    <dependencies>
        <!-- These dependencies should come in useful for most plugins. Add another one
             iff it satisfies that condition - and make sure scope is 'provided'. -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.sal</groupId>
            <artifactId>sal-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Dependencies for testing-->
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <!-- This filtering strategy tricks the IDEA plugin into including the directory
                 in the classpath -->
            <resource>
                <filtering>true</filtering>
                <directory>src/main/resources</directory>
                <includes>
                    <include>atlassian-plugin.xml</include>
                </includes>
            </resource>
            <resource>
                <filtering>false</filtering>
                <directory>src/main/resources</directory>
                <excludes>
                    <exclude>atlassian-plugin.xml</exclude>
                </excludes>
            </resource>
        </resources>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.samaxes.maven</groupId>
                    <artifactId>minify-maven-plugin</artifactId>
                    <dependencies>
                        <dependency>
                            <groupId>org.codehaus.plexus</groupId>
                            <artifactId>plexus-utils</artifactId>
                            <version>4.0.0</version>
                        </dependency>
                    </dependencies>
                    <executions>
                        <execution>
                            <id>minify-resources</id>
                            <goals>
                                <goal>minify</goal>
                            </goals>
                            <configuration>
                                <jsSourceIncludes>
                                    <jsSourceInclude>**/*.js</jsSourceInclude>
                                </jsSourceIncludes>
                                <jsSourceExcludes>
                                    <jsSourceExclude>**/*.min.js</jsSourceExclude>
                                    <jsSourceExclude>**/*-min.js</jsSourceExclude>
                                </jsSourceExcludes>
                                <cssSourceIncludes>
                                    <cssSourceInclude>**/*.css</cssSourceInclude>
                                </cssSourceIncludes>
                                <cssSourceExcludes>
                                    <cssSourceExclude>**/*.min.css</cssSourceExclude>
                                    <cssSourceExclude>**/*-min.css</cssSourceExclude>
                                </cssSourceExcludes>
                                <cssSourceDir>.</cssSourceDir>
                                <jsSourceDir>.</jsSourceDir>
                                <webappSourceDir>${project.build.outputDirectory}</webappSourceDir>
                                <webappTargetDir>${project.build.outputDirectory}</webappTargetDir>
                                <jsEngine>CLOSURE</jsEngine>
                                <suffix>-min</suffix>
                                <skipMerge>true</skipMerge>
                                <closureLanguage>ECMASCRIPT5</closureLanguage>
                                <verbose>false</verbose>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <!-- Use this artifact in plugins that have dependencies that need to be
                         compiled into the jar at build time. -->
                    <groupId>com.atlassian.maven.plugins</groupId>
                    <artifactId>confluence-maven-plugin</artifactId>
                    <configuration>
                        <closureJsCompiler>true</closureJsCompiler>
                        <skipAllPrompts>true</skipAllPrompts>
                        <extractDependencies>false</extractDependencies>
                        <productVersion>${project.version}</productVersion>
                        <productDataVersion>${confluence.data.version}</productDataVersion>
                        <parallel>true</parallel>
                        <skipVerifyFeManifestAssociations>true</skipVerifyFeManifestAssociations>
                        <systemPropertyVariables>
                            <confluence.context.batching.disable>true</confluence.context.batching.disable>
                            <plugin.webresource.batching.off>true</plugin.webresource.batching.off>
                        </systemPropertyVariables>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>ban_integration_test_dependencies</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <phase>validate</phase>
                        <configuration>
                            <rules>
                                <bannedDependencies>
                                    <message>Keep integration tests and their dependencies separate</message>
                                    <excludes>
                                        <exclude>com.atlassian.confluence:confluence-test-support</exclude>
                                    </excludes>
                                </bannedDependencies>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
