<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright (C) FuseSource, Inc.
    http://fusesource.com

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

  <parent>
    <groupId>io.fabric8.examples</groupId>
    <artifactId>examples</artifactId>
    <version>1.1.0.Beta2</version>
  </parent>
  <artifactId>camel-webservice-example</artifactId>
  <name>Camel Webservice - Customers Example</name>
  <description>Camel example exposing a webservice to add or get Customers (backend is mocked in a bean)</description>
  <packaging>bundle</packaging>

  <properties>
    <!-- Explicitly declaring the source encoding eliminates the following message: -->
    <!-- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <version.compiler.plugin>2.3.1</version.compiler.plugin>
    <version.maven-bundle-plugin>2.3.4</version.maven-bundle-plugin>

    <!-- maven-compiler-plugin -->
    <maven.compiler.target>1.6</maven.compiler.target>
    <maven.compiler.source>1.6</maven.compiler.source>

    <!-- the version of the BOM, defining all the dependency versions -->
    <fabric8.bom.version>1.1.0.Beta2</fabric8.bom.version>
    <fabric.version>1.1.0.Beta2</fabric.version>

    <!-- fabric8 deploy profile configuration -->
    <fabric8.profile>my-webservice</fabric8.profile>
    <fabric8.parentProfiles>feature-camel feature-cxf</fabric8.parentProfiles>
    <fabric8.features>camel-cxf camel-spring cxf-http-jetty</fabric8.features>
  </properties>

  <repositories>
    <repository>
      <id>fusesource</id>
      <name>FuseSource Release Repository</name>
      <url>https://repo.fusesource.com/nexus/content/groups/public/</url>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <releases>
        <enabled>true</enabled>
      </releases>
    </repository>
    <repository>
        <id>fusesource.ea</id>
        <name>FuseSource Community Early Access Release Repository</name>
        <url>https://repo.fusesource.com/nexus/content/groups/ea</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <releases>
            <enabled>true</enabled>
        </releases>
    </repository>
    <repository>
      <id>jboss-public-repository-group</id>
      <name>JBoss Public Repository Group</name>
      <url>http://repository.jboss.org/nexus/content/groups/public/</url>
      <layout>default</layout>
      <releases>
        <enabled>true</enabled>
        <updatePolicy>never</updatePolicy>
      </releases>
      <snapshots>
        <enabled>true</enabled>
        <updatePolicy>daily</updatePolicy>
      </snapshots>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>fusesource</id>
      <name>FuseSource Release Repository</name>
      <url>https://repo.fusesource.com/nexus/content/groups/public/</url>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <releases>
        <enabled>true</enabled>
      </releases>
    </pluginRepository>
    <pluginRepository>
        <id>fusesource.ea</id>
        <name>FuseSource Community Early Access Release Repository</name>
        <url>https://repo.fusesource.com/nexus/content/groups/ea</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <releases>
            <enabled>true</enabled>
        </releases>
    </pluginRepository>
  </pluginRepositories>


  <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>
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-core</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-cxf</artifactId>
    </dependency>

    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
    </dependency>

    <!-- cxf using slf4j -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
    </dependency>

    <!-- using Jetty with CXF -->
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-transports-http-jetty</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-test-spring</artifactId>
      <scope>test</scope>
    </dependency>

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

  <build>
    <plugins>

      <!-- to generate the MANIFEST-FILE required by the bundle -->
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
            <Export-Package>
              io.fabric8.example*
            </Export-Package>
            <Import-Package>
              javax.jws,
              javax.jws.soap,
              javax.xml.bind,
              javax.xml.bind.annotation,
              javax.xml.datatype,
              javax.xml.namespace,
              javax.xml.ws,
              org.apache.camel;version="[2.12,3)",

              <!-- force an import on the camel-cxf spring code to encourage camel-cxf to be started before the spring XML -->
              org.apache.camel.component.cxf.spring;version="[2.12,3)",
              org.apache.camel.builder;version="[2.12,3)",
              org.apache.camel.model;version="[2.12,3)",
              org.apache.cxf.interceptor;version="[2.7,3)",
              org.apache.cxf.message;version="[2.7,3)",
              org.slf4j;version="[1.6,2)"
            </Import-Package>
            <DynamicImport-Package>
              org.apache.cxf.*
            </DynamicImport-Package>
          </instructions>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-codegen-plugin</artifactId>
        <version>${cxf-version}</version>
        <executions>
          <execution>
            <id>generate-sources</id>
            <phase>generate-sources</phase>
            <configuration>
              <sourceRoot>${basedir}/target/generated/src/main/java</sourceRoot>
              <wsdlOptions>
                <wsdlOption>
                  <wsdl>${basedir}/src/main/resources/META-INF/wsdl/CustomerService.wsdl</wsdl>
                  <bindingFiles>
                    <bindingFile>${basedir}/src/main/resources/META-INF/wsdl/binding.xml
                    </bindingFile>
                  </bindingFiles>
                </wsdlOption>
              </wsdlOptions>
            </configuration>
            <goals>
              <goal>wsdl2java</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
      </plugin>

      <!-- allows the route to be ran via 'mvn camel:run' -->
      <plugin>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-maven-plugin</artifactId>
        <version>${camel-version}</version>
      </plugin>

      <!--
        this plugin will use the fabric.* properties to configure its behaviour
        see the Properties section here: http://fabric8.io/#/site/book/doc/index.md?chapter=mavenPlugin_md
      -->
      <plugin>
          <groupId>io.fabric8</groupId>
          <artifactId>fabric8-maven-plugin</artifactId>
          <version>${fabric.version}</version>
      </plugin>
    </plugins>
  </build>

</project>

