<?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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.atlassian.bitbucket.server</groupId>
        <artifactId>bitbucket-plugins-parent</artifactId>
        <version>8.19.1</version>
    </parent>

    <artifactId>bitbucket-ssh</artifactId>
    <packaging>atlassian-plugin</packaging>

    <name>Bitbucket Server - SSH</name>
    <description>Provides SSH support</description>

    <dependencies>
        <!-- Bitbucket API/SPI -->
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-ao-common</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-dmz-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-dmz-spi</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-notification</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-rest-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-rest-model</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-scm-common</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-spi</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-ssh-api</artifactId>
            <!--scope>bundled</scope-->
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-util</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.sshd</groupId>
            <artifactId>sshd-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.sshd</groupId>
            <artifactId>sshd-common</artifactId>
        </dependency>
        <!-- Required for Ed25519 support -->
        <dependency>
            <groupId>net.i2p.crypto</groupId>
            <artifactId>eddsa</artifactId>
        </dependency>
        <!-- WARNING: There is a check for BC on startup that is affected by changing the scope of these dependencies -->
        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcpg-lts8on</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcpkix-lts8on</artifactId>
            <scope>provided</scope>
        </dependency>
        <!-- jcl-over-slf4j gets pulled in by sshd, force provided scope -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Atlassian libraries (ActiveObjects, SAL, etc. provided by the plugin system) -->

        <dependency>
            <groupId>com.atlassian.activeobjects</groupId>
            <artifactId>activeobjects-plugin</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.audit</groupId>
            <artifactId>atlassian-audit-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.cache</groupId>
            <artifactId>atlassian-cache-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.johnson</groupId>
            <artifactId>atlassian-johnson-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-osgi</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-webfragment</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-webresource</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-webresource-common</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.sal</groupId>
            <artifactId>sal-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.scheduler</groupId>
            <artifactId>atlassian-scheduler-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.soy</groupId>
            <artifactId>soy-template-renderer-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.support</groupId>
            <artifactId>stp-spi</artifactId>
            <scope>provided</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.atlassian.templaterenderer</groupId>
            <artifactId>atlassian-template-renderer-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.atlassian.util.concurrent</groupId>
            <artifactId>atlassian-util-concurrent</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Spring (provided by the plugin system) -->

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- others (provided by the plugin system) -->

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-server</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.swagger.core.v3</groupId>
            <artifactId>swagger-jaxrs2</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server.swagger</groupId>
            <artifactId>annotations</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- test -->
        <dependency>
            <groupId>com.atlassian.activeobjects</groupId>
            <artifactId>activeobjects-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-service-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-test-util</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.cache</groupId>
            <artifactId>atlassian-cache-memory</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.atlassian.fugue</groupId>
            <artifactId>fugue</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.gemini.blueprint</groupId>
            <artifactId>gemini-blueprint-mock</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.swagger.core.v3</groupId>
            <artifactId>swagger-annotations</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>bitbucket-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <extractDependencies>true</extractDependencies>
                    <instructions>
                        <Atlassian-Plugin-Key>com.atlassian.stash.ssh-plugin</Atlassian-Plugin-Key>
                        <Export-Package>
                            com.atlassian.bitbucket.ssh*
                        </Export-Package>
                        <Private-Package>
                            com.atlassian.bitbucket.internal.ssh
                        </Private-Package>
                        <Private-Package>
                            com.atlassian.bitbucket.internal.key
                        </Private-Package>
                        <Import-Package>
                            com.atlassian.analytics.api.annotations,
                            com.atlassian.bitbucket*,
                            com.atlassian.stash*,
                            com.atlassian.activeobjects.*,
                            com.atlassian.audit.*,
                            com.atlassian.cache*,
                            com.atlassian.event*,
                            com.atlassian.johnson*,
                            com.atlassian.plugin*,
                            com.atlassian.sal.api*,
                            com.atlassian.scheduler.*,
                            com.atlassian.soy.renderer,
                            com.atlassian.support.tools.spi;resolution:="optional",
                            com.atlassian.webresource.api*,
                            com.google.common.*,
                            com.sun.jersey.spi.resource,
                            io.atlassian.util.concurrent,
                            javax.annotation,
                            javax.annotation.concurrent,
                            javax.crypto*,
                            javax.management,
                            javax.security*,
                            javax.servlet*;version="${servlet-api.osgi.import.version}",
                            javax.validation*,
                            javax.ws.rs*,
                            net.java.ao*,
                            org.apache.commons*,
                            org.bouncycastle*,
                            <!-- we need this explicit import to ensure SSHD can register BouncyCastle properly -->
                            org.bouncycastle.jce.provider,
                            org.codehaus.jackson*,
                            org.hibernate.validator.constraints,
                            org.osgi.framework,
                            org.osgi.util.tracker,
                            org.slf4j*;version="${slf4j.version}",
                            org.springframework*;version="${spring.osgi.import.version}",
                        </Import-Package>
                    </instructions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.atlassian.lesscss</groupId>
                <artifactId>lesscss-maven-plugin</artifactId>
                <configuration>
                    <webstatic>../../webapp/default/src/main/frontend</webstatic>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <!-- Needed for REST doc generation -->
                    <plugin>
                        <groupId>com.atlassian.bitbucket.server.swagger</groupId>
                        <artifactId>swagger-maven-plugin</artifactId>
                        <version>${swagger-maven-plugin-version}</version>
                        <configuration>
                            <resourcePackages>
                                <resourcePackage>com.atlassian.bitbucket.internal.ssh.rest</resourcePackage>
                                <resourcePackage>com.atlassian.bitbucket.internal.key.ssh.rest</resourcePackage>
                            </resourcePackages>
                            <enrichers>
                                <enricher>com.atlassian.bitbucket.server.swagger.enricher.BitbucketEnricher</enricher>
                            </enrichers>
                            <outputDirectory>${project.build.directory}/site</outputDirectory>
                            <outputFilename>swagger</outputFilename>
                            <outputFormats>JSON,YAML</outputFormats>
                            <prettyPrint>true</prettyPrint>
                            <swaggerConfig>
                                <servers>
                                    <server>
                                        <!-- Multiple base urls are used, and documented via the
                                        BasePathDoc annotation on the classes -->
                                        <description>Endpoint URL</description>
                                    </server>
                                </servers>
                                <info>
                                    <title>Ssh REST API</title>
                                    <version>1.0.0</version>
                                </info>
                            </swaggerConfig>
                        </configuration>
                        <dependencies>
                            <dependency>
                                <groupId>com.atlassian.bitbucket.server.swagger</groupId>
                                <artifactId>processor</artifactId>
                                <version>${bitbucket-swagger-version}</version>
                            </dependency>
                        </dependencies>
                        <executions>
                            <execution>
                                <phase>compile</phase>
                                <goals>
                                    <goal>generate</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
