<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-misc-plugins</artifactId>
        <version>5.0-OD-25</version>
    </parent>
    
    <groupId>com.atlassian.confluence.tinymceplugin</groupId>
    <artifactId>confluence-tinymce-plugin</artifactId>
    <packaging>atlassian-plugin</packaging>

    <name>TinyMCE Editor Plugin</name>
    <description>TinyMCE Editor Plugin for Confluence</description>
    <url>http://confluence.atlassian.com/display/CONFEXT/TinyMCE+Plugin</url>

    <dependencies>
	    <dependency>
            <groupId>com.atlassian.confluence</groupId>
            <artifactId>confluence</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- REST dependencies -->
        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>jsr311-api</artifactId>
            <version>1.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>atlassian-rest-common</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.image</groupId>
            <artifactId>atlassian-image-consumer</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>com.atlassian.jersey-library</artifactId>
            <type>pom</type>
            <scope>provided</scope>
        </dependency>
        
        <dependency>
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>atlassian-rest-doclet</artifactId>
            <version>2.6.2.1</version>
        </dependency>        
        
        <!-- End of REST dependencies -->

        <dependency>
            <groupId>com.atlassian.sal</groupId>
            <artifactId>sal-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.sal</groupId>
            <artifactId>sal-core</artifactId>
            <version>${sal.version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- Needed for Qualifier annotations -->        
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring</artifactId>
            <version>2.5.6</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit-dep</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <properties>
        <atlassian.plugin.key>com.atlassian.confluence.tinymceplugin</atlassian.plugin.key>
        <confluence.version>${project.version}</confluence.version>
        <atlassian.product.version>${project.version}</atlassian.product.version>
    </properties>

    <build>
        <resources>
            <!-- This filtering strategy is intentionally weird to trick the IDEA plugin into including the directory in the classpath -->
            <resource>
                <directory>src/main/resources</directory>
                <excludes>
                    <exclude>atlassian-plugin.xml</exclude>
                </excludes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>atlassian-plugin.xml</include>
                </includes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-confluence-plugin</artifactId>
                <configuration>
                    <productVersion>${project.version}</productVersion>
                    <productDataVersion>3.1</productDataVersion>
                    <instructions>
                        <Import-Package>
                            *;resolution:=optional
                        </Import-Package>
                        <Private-Package />
                        <Export-Package>
                            com.atlassian.confluence.tinymceplugin.rest.entities.*,
                            com.atlassian.confluence.tinymceplugin.service,
                        </Export-Package>
                    </instructions>
                </configuration>
                <executions>
                    <execution>
                        <id>process-resources</id>
                        <goals>
                            <goal>generate-manifest</goal>
                            <goal>copy-bundled-dependencies</goal>
                        </goals>
                        <phase>process-classes</phase>
                    </execution>
                    <execution>
                        <id>prepare-package</id>
                        <goals>
                            <goal>validate-manifest</goal>
                        </goals>
                        <phase>prepare-package</phase>
                    </execution>
                    <execution>
                        <id>package</id>
                        <goals>
                            <goal>generate-obr-artifact</goal>
                            <goal>jar</goal>
                        </goals>
                        <phase>package</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.5</version>
                <executions>
                    <execution>
                        <id>attach-bundle-artifact</id>
                        <phase>package</phase>
                        <goals>
                            <goal>attach-artifact</goal>
                        </goals>
                        <configuration>
                            <artifacts>
                                <artifact>
                                    <file>${project.build.directory}/${project.build.finalName}.jar</file>
                                    <type>jar</type>
                                </artifact>
                            </artifacts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.twdata.maven</groupId>
                <artifactId>maven-cli-plugin</artifactId>
                <configuration>
                    <commands>
                        <pi>clean resources compile jar com.atlassian.maven.plugins:atlassian-pdk:install</pi>
                        <pu>com.atlassian.maven.plugins:atlassian-pdk:uninstall</pu>
                    </commands>
                </configuration>
            </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>
                                            com.atlassian.maven.plugins
                                        </groupId>
                                        <artifactId>
                                            maven-confluence-plugin
                                        </artifactId>
                                        <versionRange>[3.7.2,)</versionRange>
                                        <goals>
                                            <goal>compress-resources</goal>
                                            <goal>generate-rest-docs</goal>
                                            <goal>generate-manifest</goal>
                                            <goal>
                                                filter-plugin-descriptor
                                            </goal>
                                            <goal>
                                                copy-bundled-dependencies
                                            </goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore />
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>
