<?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you 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>
    <artifactId>brooklyn-rest-client</artifactId>
    <packaging>jar</packaging>
    <name>Brooklyn REST java Client</name>
    <description>
        Client library for Brooklyn REST interface
    </description>

    <parent>
        <groupId>org.apache.brooklyn</groupId>
        <artifactId>brooklyn-client</artifactId>
        <version>0.10.0</version> <!-- BROOKLYN_VERSION -->
        <relativePath>../pom.xml</relativePath>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.apache.brooklyn</groupId>
            <artifactId>brooklyn-rest-api</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.brooklyn</groupId>
            <artifactId>brooklyn-api</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxrs</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-simple</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jackson2-provider</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-simple</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.brooklyn</groupId>
            <artifactId>brooklyn-utils-common</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-server</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.brooklyn</groupId>
            <artifactId>brooklyn-core</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.brooklyn</groupId>
            <artifactId>brooklyn-core</artifactId>
            <version>${project.version}</version>
            <classifier>tests</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.brooklyn</groupId>
            <artifactId>brooklyn-rest-server</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.brooklyn</groupId>
            <artifactId>brooklyn-rest-resources</artifactId>
            <version>${project.version}</version>
            <classifier>tests</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.brooklyn</groupId>
            <artifactId>brooklyn-rest-server</artifactId>
            <version>${project.version}</version>
            <classifier>tests</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.brooklyn</groupId>
            <artifactId>brooklyn-test-support</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.mockwebserver</groupId>
            <artifactId>mockwebserver</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Import-Package>*,org.jboss.resteasy.client.core.marshallers</Import-Package>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>Documentation</id>
            <reporting>
                <excludeDefaults>true</excludeDefaults>
                <plugins>
                    <plugin>
                        <artifactId>maven-project-info-reports-plugin</artifactId>
                        <version>2.4</version>
                        <reportSets>
                            <reportSet>
                                <reports>
                                    <report>index</report>
                                    <report>modules</report>
                                </reports>
                            </reportSet>
                        </reportSets>
                    </plugin>
                    <plugin>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>2.8</version>
                        <configuration>
                            <links>
                                <link>http://download.oracle.com/javaee/6/api</link>
                            </links>
                            <keywords>true</keywords>
                            <author>false</author>
                            <quiet>true</quiet>
                            <aggregate>false</aggregate>
                            <detectLinks />
                            <tags>
                                <tag>
                                    <name>todo</name>
                                    <placement>a</placement>
                                    <head>To-do:</head>
                                </tag>
                            </tags>
                        </configuration>
                        <reportSets>
                            <reportSet>
                                <id>javadoc</id>
                                <reports>
                                    <report>javadoc</report>
                                </reports>
                            </reportSet>
                        </reportSets>
                    </plugin>
                </plugins>
            </reporting>
        </profile>
        <profile>
            <id>Bundle</id>
            <activation>
                <file>
                    <!-- NB - this is all the leaf projects, including logback-* (with no src);
                         the archetype project neatly ignores this however -->
                    <exists>${basedir}/src</exists>
                </file>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.felix</groupId>
                        <artifactId>maven-bundle-plugin</artifactId>
                        <extensions>true</extensions>
                        <!-- configure plugin to generate MANIFEST.MF
                             adapted from http://blog.knowhowlab.org/2010/06/osgi-tutorial-from-project-structure-to.html -->
                        <executions>
                            <execution>
                                <id>bundle-manifest</id>
                                <phase>process-classes</phase>
                                <goals>
                                    <goal>manifest</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <supportedProjectTypes>
                                <supportedProjectType>jar</supportedProjectType>
                            </supportedProjectTypes>
                            <instructions>
                                <!-- OSGi specific instruction -->
                                <!--
                                    By default packages containing impl and internal
                                    are not included in the export list. Setting an
                                    explicit wildcard will include all packages
                                    regardless of name.
                                    In time we should minimize our export lists to
                                    what is really needed.
                                -->
                                <Export-Package>brooklyn.*,org.apache.brooklyn.*</Export-Package>
                                <Implementation-SHA-1>${buildNumber}</Implementation-SHA-1>
                                <Implementation-Branch>${scmBranch}</Implementation-Branch>
                            </instructions>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-jar-plugin</artifactId>
                        <version>2.6</version>
                        <configuration>
                            <archive>
                                <manifestFile> ${project.build.outputDirectory}/META-INF/MANIFEST.MF </manifestFile>
                            </archive>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>Tests</id>
            <activation>
                <file> <exists>${basedir}/src/test</exists> </file>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>${surefire.version}</version>
                        <configuration>
                            <properties>
                                <property>
                                    <name>listener</name>
                                    <value>org.apache.brooklyn.test.support.LoggingVerboseReporter,org.apache.brooklyn.test.support.BrooklynLeakListener,org.apache.brooklyn.test.support.PlatformTestSelectorListener</value>
                                </property>
                            </properties>
                            <enableAssertions>true</enableAssertions>
                            <groups>${includedTestGroups}</groups>
                            <excludedGroups>${excludedTestGroups}</excludedGroups>
                            <testFailureIgnore>false</testFailureIgnore>
                            <systemPropertyVariables>
                                <verbose>-1</verbose>
                                <net.sourceforge.cobertura.datafile>${project.build.directory}/cobertura/cobertura.ser</net.sourceforge.cobertura.datafile>
                                <cobertura.user.java.nio>false</cobertura.user.java.nio>
                            </systemPropertyVariables>
                            <printSummary>true</printSummary>
                        </configuration>
                    </plugin>
                    <plugin>
                        <artifactId>maven-jar-plugin</artifactId>
                        <inherited>true</inherited>
                        <executions>
                            <execution>
                                <id>test-jar-creation</id>
                                <goals>
                                    <goal>test-jar</goal>
                                </goals>
                                <configuration>
                                    <forceCreation>true</forceCreation>
                                    <archive combine.self="override" />
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>Integration</id>
            <properties>
                <includedTestGroups>Integration</includedTestGroups>
                <excludedTestGroups>Acceptance,Live,WIP,Broken</excludedTestGroups>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <inherited>true</inherited>
                        <executions>
                            <execution>
                                <id>run-tests</id>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <phase>integration-test</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>Acceptance</id>
            <properties>
                <includedTestGroups>Acceptance</includedTestGroups>
                <excludedTestGroups>Integration,Live,WIP,Broken</excludedTestGroups>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <inherited>true</inherited>
                        <executions>
                            <execution>
                                <id>run-tests</id>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <phase>integration-test</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>Live</id>
            <properties>
                <includedTestGroups>Live</includedTestGroups>
                <excludedTestGroups>Acceptance,WIP,Broken</excludedTestGroups>
            </properties>
        </profile>

        <profile>
            <id>Live-sanity</id>
            <properties>
                <includedTestGroups>Live-sanity</includedTestGroups>
                <excludedTestGroups>Acceptance,WIP,Broken</excludedTestGroups>
            </properties>
        </profile>

        <profile>
            <id>CI</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>findbugs-maven-plugin</artifactId>
                        <configuration>
                            <xmlOutput>true</xmlOutput>
                            <xmlOutputDirectory>target/site</xmlOutputDirectory>
                        </configuration>
                        <executions>
                            <execution>
                                <phase>process-classes</phase>
                                <goals>
                                    <goal>findbugs</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-source-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <artifactId>maven-pmd-plugin</artifactId>
                        <version>2.5</version>
                        <inherited>true</inherited>
                        <configuration>
                            <failOnViolation>false</failOnViolation>
                            <linkXref>true</linkXref>
                            <sourceEncoding>${project.build.sourceEncoding}</sourceEncoding>
                            <minimumTokens>100</minimumTokens>
                            <targetJdk>${java.version}</targetJdk>
                            <excludes>
                                <exclude>**/*Test.java</exclude>
                                <exclude>**/tests/**/*.java</exclude>
                                <!-- add any more generated source code directories here -->
                            </excludes>
                            <excludeRoots>
                                <excludeRoot>
                                    ${pom.basedir}/target/generated-sources/groovy-stubs/main
                                </excludeRoot>
                            </excludeRoots>
                        </configuration>
                        <executions>
                            <execution>
                                <phase>process-classes</phase>
                                <goals>
                                    <goal>check</goal>
                                    <goal>cpd-check</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>Coverage</id>
            <dependencies>
                <dependency>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>cobertura-maven-plugin</artifactId>
                    <version>${cobertura.plugin.version}</version>
                    <scope>test</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-source-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <inherited>true</inherited>
                        <executions>
                            <execution>
                                <id>run-tests</id>
                            </execution>
                            <execution>
                                <id>instrument classes</id>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <phase>process-test-classes</phase>
                                <configuration>
                                    <target>
                                        <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpathref="maven.plugin.classpath" />
                                        <taskdef resource="tasks.properties" classpathref="maven.plugin.classpath" />
                                        <if>
                                            <available property="gogocobertura" file="target/test-classes" />
                                            <then>
                                                <echo message="INSTRUMENTING CLASSES FOR COBERTURA" />
                                                <!-- Ensure any and all bits of our project are copied in first -->
                                                <copy todir="target/cobertura/coverage-classes">
                                                    <fileset erroronmissingdir="false" dir="target/classes" />
                                                </copy>
                                                <cobertura-instrument datafile="target/cobertura/cobertura.ser" todir="target/test-classes">
                                                    <fileset erroronmissingdir="false" dir="target/classes">
                                                        <include name="brooklyn/**/*.class" />
                                                        <exclude name="brooklyn/**/*Test.class" />
                                                    </fileset>
                                                    <fileset erroronmissingdir="false" dir="target/cobertura/dependency-classes">
                                                        <include name="brooklyn/**/*.class" />
                                                        <exclude name="brooklyn/**/*Test.class" />
                                                    </fileset>
                                                </cobertura-instrument>
                                            </then>
                                        </if>
                                    </target>
                                </configuration>
                            </execution>
                            <execution>
                                <id>coverage report</id>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <phase>post-integration-test</phase>
                                <configuration>
                                    <target>
                                        <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpathref="maven.plugin.classpath" />
                                        <taskdef resource="tasks.properties" classpathref="maven.plugin.classpath" />
                                        <if>
                                            <available property="gogocobertura" file="target/cobertura/cobertura.ser" />
                                            <then>
                                                <echo message="GENERATING COBERTURA COVERAGE REPORT" />
                                                <cobertura-report format="xml" destdir="target/site/cobertura" datafile="target/cobertura/cobertura.ser">
                                                    <fileset erroronmissingdir="false" dir="src/main/java" />
                                                    <fileset erroronmissingdir="false" dir="target/cobertura/dependency-sources" />
                                                </cobertura-report>
                                                <cobertura-report format="html" destdir="target/site/cobertura" datafile="target/cobertura/cobertura.ser">
                                                    <fileset erroronmissingdir="false" dir="src/main/java" />
                                                    <fileset erroronmissingdir="false" dir="target/cobertura/dependency-sources" />
                                                </cobertura-report>
                                            </then>
                                        </if>
                                    </target>
                                </configuration>
                            </execution>
                        </executions>
                        <dependencies>
                            <dependency>
                                <groupId>ant-contrib</groupId>
                                <artifactId>ant-contrib</artifactId>
                                <version>1.0b3</version>
                                <exclusions>
                                    <exclusion>
                                        <groupId>ant</groupId>
                                        <artifactId>ant</artifactId>
                                    </exclusion>
                                </exclusions>
                            </dependency>
                            <dependency>
                                <groupId>org.apache.ant</groupId>
                                <artifactId>ant-launcher</artifactId>
                                <version>${ant.version}</version>
                            </dependency>
                            <dependency>
                                <groupId>org.apache.ant</groupId>
                                <artifactId>ant</artifactId>
                                <version>${ant.version}</version>
                            </dependency>
                            <dependency>
                                <groupId>org.testng</groupId>
                                <artifactId>testng</artifactId>
                                <version>${testng.version}</version>
                            </dependency>
                            <dependency>
                                <groupId>org.codehaus.mojo</groupId>
                                <artifactId>cobertura-maven-plugin</artifactId>
                                <version>${cobertura.plugin.version}</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                    <plugin>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>unpack-coverage-sources</id>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>unpack-dependencies</goal>
                                </goals>
                                <configuration>
                                    <classifier>sources</classifier>
                                    <includeScope>compile</includeScope>
                                    <includeGroupIds>brooklyn</includeGroupIds>
                                    <outputDirectory>
                                        ${project.build.directory}/cobertura/dependency-sources
                                    </outputDirectory>
                                    <failOnMissingClassifierArtifact>false</failOnMissingClassifierArtifact>
                                </configuration>
                            </execution>
                            <execution>
                                <id>unpack-coverage-classes</id>
                                <phase>compile</phase>
                                <goals>
                                    <goal>unpack-dependencies</goal>
                                </goals>
                                <configuration>
                                    <type>jar</type>
                                    <includeScope>compile</includeScope>
                                    <includeGroupIds>brooklyn</includeGroupIds>
                                    <outputDirectory>
                                        ${project.build.directory}/cobertura/dependency-classes
                                    </outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>${surefire.version}</version>
                        <inherited>true</inherited>
                        <configuration>
                            <reportFormat>xml</reportFormat>
                            <classesDirectory>${project.build.directory}/cobertura/coverage-classes</classesDirectory>
                            <systemProperties>
                                <property>
                                    <name>net.sourceforge.cobertura.datafile</name>
                                    <value>${project.build.directory}/cobertura/cobertura.ser
                                    </value>
                                </property>
                                <property>
                                    <name>cobertura.user.java.nio</name>
                                    <value>false</value>
                                </property>
                            </systemProperties>
                        </configuration>
                    </plugin>
                    <plugin>
                        <artifactId>maven-jar-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>test-jar-creation</id>
                                <configuration>
                                    <skip>true</skip>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-deploy-plugin</artifactId>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- build sources jars by default, it's quick -->
        <profile>
            <id>make-sources-jar</id>
            <activation> <property><name>!skipSources</name></property> </activation>
            <build><plugins><plugin>
                <artifactId>maven-source-plugin</artifactId>
            </plugin></plugins></build>
        </profile>

        <!-- only build javadoc if asked, or if deploying (it's slow) -->
        <profile>
            <id>make-javadoc-jar</id>
            <activation> <property><name>javadoc</name></property> </activation>
            <build><plugins><plugin>
                <artifactId>maven-javadoc-plugin</artifactId>
            </plugin></plugins></build>
        </profile>

        <!-- sign and make javadoc when deploying; note, this means you'll need gpg set up to deploy -->
        <profile>
            <id>make-more-things-when-deploying</id>
            <activation> <property><name>brooklyn.deployTo</name></property> </activation>
            <build><plugins>
                <plugin>
                    <artifactId>maven-javadoc-plugin</artifactId>
                </plugin>
                <plugin>
                    <artifactId>maven-gpg-plugin</artifactId>
                </plugin>
            </plugins></build>
        </profile>
        <profile>
            <id>apache-repo</id>
            <activation> <property><name>brooklyn.deployTo</name><value>apache</value></property> </activation>
            <!-- distributionManagement configured by the parent Apache POM -->
        </profile>
        <profile>
            <id>eclipse-compiler</id>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-compiler-plugin</artifactId>
                            <configuration>
                                <compilerId>eclipse</compilerId>
                                <optimize>true</optimize>
                            </configuration>
                            <dependencies>
                                <dependency>
                                    <groupId>org.codehaus.plexus</groupId>
                                    <artifactId>plexus-compiler-eclipse</artifactId>
                                    <version>2.6</version>
                                </dependency>
                            </dependencies>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>
    </profiles>

</project>
