<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2016, WSO2 Inc. (http://wso2.com) All Rights Reserved.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<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>org.wso2.msf4j</groupId>
        <artifactId>msf4j-parent</artifactId>
        <version>2.6.4</version>
        <relativePath>../poms/parent/pom.xml</relativePath>
    </parent>

    <artifactId>msf4j-core</artifactId>
    <packaging>bundle</packaging>

    <name>WSO2 MSF4J core</name>
    <description>WSO2 MSF4J core</description>
    <url>https://github.com/wso2/msf4j</url>

    <dependencies>
        <dependency>
            <groupId>org.wso2.carbon.messaging</groupId>
            <artifactId>org.wso2.carbon.messaging</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.wso2.carbon</groupId>
                    <artifactId>wso2carbon-kernel</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.wso2.carbon</groupId>
                    <artifactId>org.wso2.carbon.server.feature</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.wso2.carbon</groupId>
                    <artifactId>org.wso2.carbon.osgi.feature</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.wso2.transport.http</groupId>
            <artifactId>org.wso2.transport.http.netty</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.wso2.carbon.messaging</groupId>
                    <artifactId>org.wso2.carbon.messaging</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.wso2.orbit.org.yaml</groupId>
                    <artifactId>snakeyaml</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.wso2.eclipse.osgi</groupId>
            <artifactId>org.eclipse.osgi</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.eclipse.osgi</groupId>
            <artifactId>org.eclipse.osgi.services</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>javax.ws.rs-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.msf4j</groupId>
            <artifactId>jaxrs-delegates</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.servicemix.bundles</groupId>
            <artifactId>org.apache.servicemix.bundles.commons-beanutils</artifactId>
        </dependency>
        <dependency>
            <groupId>com.nimbusds</groupId>
            <artifactId>nimbus-jose-jwt</artifactId>
        </dependency>
        <dependency>
            <groupId>org.yaml</groupId>
            <artifactId>snakeyaml</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.config</groupId>
            <artifactId>org.wso2.carbon.config</artifactId>
        </dependency>


        <dependency>
            <groupId>commons-io.wso2</groupId>
            <artifactId>commons-io</artifactId>
        </dependency>

        <!-- Test dependencies -->
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpmime</artifactId>
            <version>4.5.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.shared</groupId>
            <artifactId>maven-invoker</artifactId>
            <version>2.2</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.rat</groupId>
                <artifactId>apache-rat-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <argLine>-Dmsf4jTestRunning</argLine>
                    <suiteXmlFiles>
                        <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
                    </suiteXmlFiles>
                    <systemPropertyVariables>
                        <maven.home>${maven.home}</maven.home>
                        <project.filepath>${project.basedir}</project.filepath>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.6</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.wso2.carbon.config</groupId>
                <artifactId>org.wso2.carbon.config.maven.plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <!-- Profile for generating coverage report -->
        <profile>
            <id>coverage</id>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-surefire-plugin</artifactId>
                            <configuration>
                                <argLine>${argLine} -Xmx512m</argLine>
                            </configuration>
                        </plugin>
                        <plugin>
                            <groupId>org.jacoco</groupId>
                            <artifactId>jacoco-maven-plugin</artifactId>
                            <executions>
                                <execution>
                                    <id>prepare-agent</id>
                                    <goals>
                                        <goal>prepare-agent</goal>
                                    </goals>
                                </execution>
                                <execution>
                                    <id>report</id>
                                    <phase>prepare-package</phase>
                                    <goals>
                                        <goal>report</goal>
                                    </goals>
                                </execution>
                            </executions>
                        </plugin>
                    </plugins>
                </pluginManagement>

                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Profile for creating all deployment artifacts -->
        <profile>
            <id>release</id>
            <build>
                <pluginManagement>
                    <plugins>
                        <!-- Source jar -->
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-source-plugin</artifactId>
                            <configuration>
                                <excludeResources>true</excludeResources>
                            </configuration>
                            <executions>
                                <execution>
                                    <id>attach-sources</id>
                                    <phase>package</phase>
                                    <goals>
                                        <goal>jar-no-fork</goal>
                                    </goals>
                                </execution>
                            </executions>
                        </plugin>

                        <!-- Javadoc jar -->
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-javadoc-plugin</artifactId>
                            <configuration>
                                <detectJavaApiLink>true</detectJavaApiLink>
                                <links>
                                    <link>http://docs.oracle.com/javaee/6/api/</link>
                                </links>
                                <excludePackageNames>*.internal.*</excludePackageNames>
                                <bottom>
                                    <![CDATA[Copyright {currentYear} WSO2, Inc. <a href="http://www.apache.org/licenses/LICENSE-2.0">Licensed under the Apache License, Version 2.0</a>]]>
                                </bottom>
                            </configuration>
                            <executions>
                                <execution>
                                    <id>attach-javadoc</id>
                                    <phase>package</phase>
                                    <goals>
                                        <goal>jar</goal>
                                    </goals>
                                </execution>
                            </executions>
                        </plugin>

                        <!-- GPG signature -->
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-gpg-plugin</artifactId>
                            <configuration>
                                <passphrase>${gpg.passphrase}</passphrase>
                                <useAgent>${gpg.useagent}</useAgent>
                            </configuration>
                            <executions>
                                <execution>
                                    <goals>
                                        <goal>sign</goal>
                                    </goals>
                                </execution>
                            </executions>
                        </plugin>
                    </plugins>
                </pluginManagement>

                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <properties>
        <bundle.activator>org.wso2.msf4j.internal.MicroservicesServerActivator</bundle.activator>
        <private.package>org.wso2.msf4j.internal.*</private.package>
        <export.package>
            !org.wso2.msf4j.internal.*,
            !org.wso2.msf4j.delegates.*,
            org.wso2.msf4j.*;version="${msf4j.version}"
        </export.package>
        <import.package>
            org.wso2.msf4j.delegates.*;version="${msf4j.version}",
            org.apache.commons.io.*;version="${commons-io.version.range}",
            com.google.gson.*;version="${gson.version.range}",
            javax.annotation.*,
            javax.ws.rs.*,
            javax.websocket.*;version="${javax.websocket.version}",
            javax.xml.bind;resolution:=optional,
            javax.xml.bind.annotation;resolution:=optional,
            org.slf4j.*;version="${slf4j.version.range}",
            org.apache.commons.beanutils.*;version="${beanutils.version.range}",
            org.osgi.framework.*;version="${osgi.framework.import.version.range}",
            org.osgi.util.tracker; version="${osgi.service.tracker.import.version.range}",
            org.wso2.carbon.kernel.startupresolver.*;version="${carbon.kernel.version.range}",
            org.wso2.carbon.config.*;version="${carbon.config.package.import.version.range}",
            org.wso2.transport.*;version="${org.wso2.transport.http.version.range}",
            io.netty.*;version="${netty.version.range}"
        </import.package>
        <carbon.component>
            startup.listener;componentName="wso2-microservices-server";requiredService="org.wso2.msf4j.Microservice,org.wso2.msf4j.Interceptor,
            org.wso2.msf4j.interceptor.OSGiInterceptorConfig,org.wso2.carbon.config.provider.ConfigProvider",
            startup.listener;componentName="wso2-websocket-server";requiredService="org.wso2.msf4j.WebSocketEndpoint",
            osgi.service;objectClass="org.wso2.msf4j.internal.MicroservicesServerSC",
            osgi.service;objectClass="org.wso2.msf4j.internal.websocket.WebSocketServerSC"
        </carbon.component>
    </properties>
</project>
