<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-project</artifactId>
        <version>5.0-rotp8</version>
        <relativePath>../..</relativePath>
    </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.confluence.plugins</groupId>
            <artifactId>confluence-de_DE-plugin</artifactId>
            <version>1.21</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence.plugins</groupId>
            <artifactId>confluence-fr_FR-plugin</artifactId>
            <version>1.24.2</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>true</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>
    </build>
</project>
