<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-build</artifactId>
        <version>5.5.1-m6</version>
    </parent>

    <artifactId>confluence-bundled-plugins-setup-library</artifactId>
    <packaging>war</packaging>
    <name>Confluence Bundled Plugins Setup Library</name>
    <description>Builds the bundled plugins directory used during setup. This directory is published as a WAR, used as
        an overlay onto the confluence webapp.
        This pom will become unnecessary once the bundled plugins maven plugin supports exclusions.
    </description>


    <dependencies>
        <dependency>
            <groupId>com.atlassian.translations</groupId>
            <artifactId>confluence-language-pack-de_DE</artifactId>
            <version>${confluence.language.german.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.translations</groupId>
            <artifactId>confluence-language-pack-fr_FR</artifactId>
            <version>${confluence.language.french.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.translations</groupId>
            <artifactId>confluence-language-pack-ja_JP</artifactId>
            <version>${confluence.language.japanese.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.translations</groupId>
            <artifactId>confluence-language-pack-es_ES</artifactId>
            <version>${confluence.language.spanish.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>jquery</artifactId>
            <version>${jquery.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.aui</groupId>
            <artifactId>auiplugin</artifactId>
            <version>${aui.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.aui</groupId>
            <artifactId>auiplugin-integration-sal</artifactId>
            <version>${aui.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence.plugins</groupId>
            <artifactId>confluence-sal-setup-plugin</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <!-- CONF-25603: aui-staging is required during setup -->
            <groupId>com.atlassian.confluence.plugins</groupId>
            <artifactId>confluence-aui-staging</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy dependencies</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/atlassian-bundled-plugins-setup</outputDirectory>
                            <includeScope>provided</includeScope>
                            <excludeTransitive>true</excludeTransitive>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <attachClasses>false</attachClasses>
                    <archive>
                        <!-- It's all jars anyway. Compressing takes ~5-6 seconds (of 13-14 second build) to drop 3 megs out of 93 -->
                        <compress>false</compress>
                    </archive>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>require_provided_dependencies</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <phase>validate</phase>
                        <configuration>
                            <rules>
                                <bannedDependencies>
                                    <searchTransitive>false</searchTransitive>
                                    <message>Bundled plugins must have _provided_ scope to be properly bundled. Using _compile_ or _runtime_ will end up in WEB-INF/lib</message>
                                    <excludes>
                                        <!-- group:artifact:version:package:scope -->
                                        <exclude>*:*:*:*:compile</exclude>
                                        <exclude>*:*:*:*:runtime</exclude>
                                    </excludes>
                                </bannedDependencies>
                                <bannedDependencies>
                                    <searchTransitive>true</searchTransitive>
                                    <message>Plugins should not suck in dependencies on core Confluence classes</message>
                                    <excludes>
                                        <exclude>com.atlassian.confluence:confluence</exclude>
                                    </excludes>
                                </bannedDependencies>
                            </rules>
                            <fail>true</fail>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>
                                            org.apache.maven.plugins
                                        </groupId>
                                        <artifactId>
                                            maven-dependency-plugin
                                        </artifactId>
                                        <versionRange>
                                            [2.1-atlassian-2,)
                                        </versionRange>
                                        <goals>
                                            <goal>copy-dependencies</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore />
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>
