<?xml version="1.0" encoding="UTF-8"?>
<!--
    JBoss, Home of Professional Open Source
    Copyright 2014, Red Hat, Inc. and/or its affiliates, and individual
    contributors by the @authors tag. See the copyright.txt in the
    distribution for a full listing of individual contributors.

    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>io.fabric8.quickstarts</groupId>
    <artifactId>fabric8-quickstarts-cxf-parent</artifactId>
    <version>1.2.0.redhat-630347-05</version>
  </parent>

    <groupId>io.fabric8.quickstarts</groupId>
    <artifactId>cxf-rest</artifactId>
    <version>1.2.0.redhat-630347-05</version>
    <packaging>bundle</packaging>
    <name>JBoss Fuse Quickstart: rest</name>
    <description>RESTful WebService Example using JAX-RS with JBoss Fuse</description>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <distribution>repo</distribution>
            <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
        </license>
    </licenses>

    <repositories>
       <repository>
            <id>redhat-ga-repository</id>
            <url>https://maven.repository.redhat.com/ga</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>redhat-ea-repository</id>
            <url>https://maven.repository.redhat.com/earlyaccess/all</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>redhat-ga-repository</id>
            <url>https://maven.repository.redhat.com/ga</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
        <pluginRepository>
            <id>redhat-ea-repository</id>
            <url>https://maven.repository.redhat.com/earlyaccess/all</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>
    <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <version.compiler.plugin>2.3.1</version.compiler.plugin>
    <maven.compiler.target>1.7</maven.compiler.target>
    <maven.compiler.source>1.7</maven.compiler.source>
    <version.maven-surefire-plugin>2.19.1</version.maven-surefire-plugin>
    <version.maven-bundle-plugin>2.3.7</version.maven-bundle-plugin>
    <maven-resources-plugin-version>2.6</maven-resources-plugin-version>
    <build-helper-maven-plugin-version>1.9.1</build-helper-maven-plugin-version>
    <cxf-version>3.1.5.redhat-630347-05</cxf-version>
    <skipTests>true</skipTests>


    <!-- the version of the BOM, defining all the dependency versions -->
    <fabric8.bom.version>1.2.0.redhat-630347-05</fabric8.bom.version>
    <fabric.version>1.2.0.redhat-630347-05</fabric.version>

    <!-- fabric8 deploy profile configuration -->
    <fabric8.profile>quickstarts-cxf-rest</fabric8.profile>
    <fabric8.parentProfiles>feature-cxf</fabric8.parentProfiles>
    <fabric8.features>cxf-jaxrs swagger</fabric8.features>
  </properties>

    <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>io.fabric8.bom</groupId>
        <artifactId>fabric8-bom</artifactId>
        <version>${fabric8.bom.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

    <dependencies>
    <!--
        For coding the example, we don't actually depend on any CXF classes - we only use the JAX-RS (JSR-339)
        standard annotations and API
    -->
    <dependency>
      <groupId>org.apache.servicemix.specs</groupId>
      <artifactId>org.apache.servicemix.specs.jsr339-api-2.0</artifactId>
      <scope>provided</scope>
    </dependency>

    <!--
        For logging, we will use SLF4J, which is also available in the container by default.
      -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>

    <!-- Test Dependencies -->

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>

    <!--
        We are also building a small Java client application that we can use to test our web web services.
        For performing the HTTP requests, we are using Apache Commons HttpClient.
    -->
    <dependency>
      <groupId>commons-httpclient</groupId>
      <artifactId>commons-httpclient</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>commons-logging</groupId>
          <artifactId>commons-logging</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jcl-over-slf4j</artifactId>
    </dependency>

    <!--
      Add the slf4j-log4j12 dependency jar for testing
    -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.servicemix.bundles</groupId>
      <artifactId>org.apache.servicemix.bundles.swagger-jaxrs</artifactId>
      <optional>true</optional>
      <exclusions>
        <exclusion>
          <groupId>javassist</groupId>
          <artifactId>javassist</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.javassist</groupId>
      <artifactId>javassist</artifactId>
      <version>3.18.1-GA</version>
    </dependency>
    <dependency>
      <groupId>joda-time</groupId>
      <artifactId>joda-time</artifactId>
    </dependency>
    <dependency>
      <groupId>xml-apis</groupId>
      <artifactId>xml-apis</artifactId>
      <version>1.4.01</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.module</groupId>
      <artifactId>jackson-module-jsonSchema</artifactId>
      <version>2.4.3</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.module</groupId>
      <artifactId>jackson-module-scala_2.10</artifactId>
      <version>2.4.3</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-frontend-jaxrs</artifactId>
    </dependency>
  </dependencies>

    <build>
    <finalName>${project.artifactId}</finalName>

    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
      </resource>
    </resources>

    <plugins>
      <!-- Skip Test by default and enable them only in Test profile -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${version.maven-surefire-plugin}</version>
        <configuration>
          <skipTests>${skipTests}</skipTests>
        </configuration>
      </plugin>
      <!-- Compiler plugin enforces Java 1.7 compatibility and activates annotation processors -->
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${version.compiler.plugin}</version>
        <configuration>
          <source>${maven.compiler.source}</source>
          <target>${maven.compiler.target}</target>
        </configuration>
      </plugin>
      <!-- Need to setup the OSGi meta information here -->
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>${version.maven-bundle-plugin}</version>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <Import-Package>
              javax.ws.rs,
              javax.ws.rs.core,
              javax.xml.bind.annotation,
              org.osgi.service.blueprint,
              com.wordnik.swagger.jaxrs.config,
              com.wordnik.swagger.jaxrs.listing,
              com.wordnik.swagger.annotations,
              org.apache.cxf.transport.http,
              io.fabric8.cxf,
              javax.annotation;version="[1.1.0,2.0.0)",
              com.fasterxml.jackson.annotation, com.fasterxml.jackson.core, com.fasterxml.jackson.databind,
              com.fasterxml.jackson.jaxrs.json, javax.ws.rs.ext,*
            </Import-Package>
            <Import-Service>org.apache.aries.blueprint.NamespaceHandler;
                osgi.service.blueprint.namespace=http://cxf.apache.org/transports/http/configuration
            </Import-Service>
            <Export-Package>
              io.fabric8.quickstarts.rest
            </Export-Package>
          </instructions>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <version>${maven-resources-plugin-version}</version>
        <executions>
          <execution>
            <id>filter</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>resources</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>${build-helper-maven-plugin-version}</version>
        <executions>
          <execution>
            <id>attach-artifacts</id>
            <phase>package</phase>
            <goals>
              <goal>attach-artifact</goal>
            </goals>
            <configuration>
              <artifacts>
                <artifact>
                  <file>target/classes/features.xml</file>
                  <type>xml</type>
                  <classifier>features</classifier>
                </artifact>
              </artifacts>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-java2wadl-plugin</artifactId>
        <version>${cxf-version}</version>
        <executions>
          <execution>
            <id>parsejavadoc</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>parsejavadoc</goal>
            </goals>
          </execution>
          <execution>
            <id>process-classes</id>
            <phase>process-classes</phase>
            <goals>
              <goal>java2wadl</goal>
            </goals>
            <configuration>
              <classResourceNames>
                <classResourceName>io.fabric8.quickstarts.rest.CustomerService</classResourceName>
              </classResourceNames>
              <docProvider>org.apache.cxf.maven_plugin.javatowadl.ResourceMapJavaDocProvider</docProvider>
              <attachWadl>false</attachWadl>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>io.fabric8</groupId>
        <artifactId>fabric-cxf-plugins</artifactId>
        <version>${fabric.version}</version>
        <executions>
          <execution>
            <id>process-classes</id>
            <phase>process-classes</phase>
            <goals>
              <goal>java2swagger</goal>
            </goals>
            <configuration>
              <classResourceNames>
                <classResourceName>io.fabric8.quickstarts.rest.CustomerService</classResourceName>
              </classResourceNames>
              <attachSwagger>false</attachSwagger>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <!--
          this plugin will use the fabric.* properties to configure its behaviour
          see the Properties section here: http://fabric8.io/gitbook/mavenPlugin.html
        -->
        <groupId>io.fabric8</groupId>
        <artifactId>fabric8-maven-plugin</artifactId>
        <version>${fabric.version}</version>
      </plugin>
    </plugins>
  </build>

    <profiles>
    <profile>
      <id>test</id>
      <properties>
        <skipTests>false</skipTests>
      </properties>
      <build>
        <defaultGoal>verify</defaultGoal>
      </build>
    </profile>
  </profiles>
</project>
