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

    <parent>
        <artifactId>components</artifactId>
        <groupId>org.apache.camel</groupId>
        <version>2.15.4</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>camel-web</artifactId>

    <name>Camel :: Web</name>
    <description>Camel Web Application with REST support</description>
    <packaging>war</packaging>

    <properties>
        <camel.osgi.export.pkg>org.apache.camel.web.*</camel.osgi.export.pkg>
        <scalate-version>1.7.0</scalate-version>
        <jersey-version>1.17.1</jersey-version>
        <jetty-port>8080</jetty-port>
        <webdriver-version>0.9.7376</webdriver-version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-spring</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-jaxb</artifactId>
        </dependency>
        <dependency>
            <groupId>com.sun.jersey.contribs</groupId>
            <artifactId>jersey-spring</artifactId>
            <version>${jersey-version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
        </dependency>
        <dependency>
          <groupId>com.sun.jersey</groupId>
          <artifactId>jersey-json</artifactId>
          <version>${jersey-version}</version>
          <exclusions>
            <!-- exclude jackson so we can use the version by camel-jackson -->
            <exclusion>
                <groupId>org.codehaus.jackson</groupId>
                <artifactId>jackson-core-asl</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.codehaus.jackson</groupId>
                <artifactId>jackson-mapper-asl</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.codehaus.jackson</groupId>
                <artifactId>jackson-jaxrs</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.codehaus.jackson</groupId>
                <artifactId>jackson-xc</artifactId>
            </exclusion>
          </exclusions>
        </dependency>

        <!-- jackson for jersey-json -->
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-core-asl</artifactId>
            <version>${jackson-version}</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-mapper-asl</artifactId>
            <version>${jackson-version}</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-jaxrs</artifactId>
            <version>${jackson-version}</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-xc</artifactId>
            <version>${jackson-version}</version>
        </dependency>

        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-atom</artifactId>
            <version>${jersey-version}</version>
            <exclusions>
                <exclusion>
                    <groupId>rome</groupId>
                    <artifactId>rome</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>jsr250-api</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.scalatra.scalate</groupId>
            <artifactId>scalate-core_2.11</artifactId>
            <version>${scalate-version}</version>
        </dependency>

        <!-- even when pre-compiling the tempaltes this still seems to be a requirement - maybe can remove it later? -->
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-compiler</artifactId>
            <version>${scala-version}</version>
        </dependency>

        <!-- log4j needed by mvn jetty:run -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
        </dependency>

        <!-- testing web framework -->
        <dependency>
            <groupId>org.seleniumhq.webdriver</groupId>
            <artifactId>webdriver-htmlunit</artifactId>
            <version>${webdriver-version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.webdriver</groupId>
            <artifactId>webdriver-support</artifactId>
            <version>${webdriver-version}</version>
            <scope>test</scope>
        </dependency>

        <!-- testing web container -->
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-server</artifactId>
            <version>${jetty-version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-webapp</artifactId>
            <version>${jetty-version}</version>
            <scope>test</scope>
        </dependency>

        <!-- testing -->
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-client</artifactId>
            <version>${jersey-version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
            </resource>
        </resources>

        <plugins>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <!--
                             these settings are mandatory to avoid SureFire giving a bogus
                             system property to the web container
                         -->
                    <useSystemClassLoader>false</useSystemClassLoader>
                    <useManifestOnlyJar>false</useManifestOnlyJar>
                </configuration>
            </plugin>

            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <attachClasses>true</attachClasses>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.scalatra.scalate</groupId>
                <artifactId>maven-scalate-plugin_2.11</artifactId>
                <version>${scalate-version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>precompile</goal>
                        </goals>
                        <phase>process-classes</phase>
                    </execution>
                </executions>
            </plugin>

            <!-- mvn tomcat7:run -->
            <plugin>
              <groupId>org.apache.tomcat.maven</groupId>
              <artifactId>tomcat7-maven-plugin</artifactId>
            </plugin>


            <!-- mvn jetty:run -->
            <plugin>
                <groupId>${jetty-runner-groupId}</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <configuration>
                    <!--
                             <connectors> <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
                             <port>${jetty.port}</port> <maxIdleTime>60000</maxIdleTime>
                             </connector> </connectors>
                         -->

                    <webAppConfig>
                        <contextPath>/</contextPath>
                    </webAppConfig>

                    <systemProperties>
                        <!-- enable easy JMX connection to JConsole -->
                        <systemProperty>
                            <name>com.sun.management.jmxremote</name>
                            <value />
                        </systemProperty>
                    </systemProperties>
                    <!--
                    <scanIntervalSeconds>10</scanIntervalSeconds>
                    -->
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>tomcat-maven-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>java</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <classpathScope>test</classpathScope>
                    <mainClass>org.apache.camel.web.Main</mainClass>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <dependencies>
                    <dependency>
                        <groupId>commons-io</groupId>
                        <artifactId>commons-io</artifactId>
                        <version>1.3.2</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <goals>
                            <goal>javadoc</goal>
                        </goals>
                        <phase>package</phase>
                    </execution>
                </executions>

                <configuration>
                    <encoding>UTF-8</encoding>
                    <verbose>false</verbose>
                    <show>public</show>
                    <subpackages>org.apache.camel.web.resources</subpackages>
                    <!-- see http://jira.codehaus.org/browse/MJAVADOC-229 -->
                    <useStandardDocletOptions>false</useStandardDocletOptions>
                    <doclet>com.sun.jersey.wadl.resourcedoc.ResourceDoclet</doclet>
                    <docletArtifacts>
                        <docletArtifact>
                            <groupId>com.sun.jersey.contribs</groupId>
                            <artifactId>maven-wadl-plugin</artifactId>
                            <version>${jersey-version}</version>
                        </docletArtifact>
                        <docletArtifact>
                            <groupId>com.sun.jersey.contribs</groupId>
                            <artifactId>wadl-resourcedoc-doclet</artifactId>
                            <version>${jersey-version}</version>
                        </docletArtifact>
                        <!--
                            Also specify jersey and xerces as doclet artifacts as the
                            ResourceDoclet uses classes provided by them to generate the
                            resourcedoc.
                        -->
                        <docletArtifact>
                            <groupId>com.sun.jersey</groupId>
                            <artifactId>jersey-server</artifactId>
                            <version>${jersey-version}</version>
                        </docletArtifact>
                        <docletArtifact>
                            <groupId>xerces</groupId>
                            <artifactId>xercesImpl</artifactId>
                            <version>${xerces-version}</version>
                        </docletArtifact>
                        <docletArtifact>
                            <groupId>javax.xml.bind</groupId>
                            <artifactId>jaxb-api</artifactId>
                            <version>${jaxb-version}</version>
                        </docletArtifact>
                        <docletArtifact>
                            <groupId>com.sun.xml.bind</groupId>
                            <artifactId>jaxb-impl</artifactId>
                            <version>${jaxb-version}</version>
                        </docletArtifact>
                        <docletArtifact>
                            <groupId>stax</groupId>
                            <artifactId>stax-api</artifactId>
                            <version>${stax-api-version}</version>
                        </docletArtifact>
                    </docletArtifacts>
                    <additionalparam>-output
                      ${project.build.outputDirectory}${file.separator}resourcedoc.xml
                    </additionalparam>
                </configuration>
            </plugin>
<!-- Disable wadl generation for now, fails on Java 8-->
<!--
            <plugin>
                <groupId>com.sun.jersey.contribs</groupId>
                <artifactId>maven-wadl-plugin</artifactId>
                <version>${jersey-version}</version>
                <executions>
                    <execution>
                        <id>generate</id>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <phase>package</phase>
                    </execution>
                </executions>
                <configuration>
                    <wadlFile>${project.build.outputDirectory}/application.wadl</wadlFile>
                    <formatWadlFile>true</formatWadlFile>
                    <baseUri>http://www.example.com/api</baseUri>
                    <packagesResourceConfig>
                        <param>org.apache.camel.web.resources</param>
                    </packagesResourceConfig>
                    <wadlGenerators>
                        <wadlGeneratorDescription>
                            <className>com.sun.jersey.server.wadl.generators.WadlGeneratorApplicationDoc</className>
                            <properties>
                                <property>
                                    <name>applicationDocsFile</name>
                                    <value>${basedir}/src/main/resources/application-doc.xml</value>
                                </property>
                            </properties>
                        </wadlGeneratorDescription>
                        <wadlGeneratorDescription>
                            <className>com.sun.jersey.server.wadl.generators.WadlGeneratorGrammarsSupport</className>
                            <properties>
                                <property>
                                    <name>grammarsFile</name>
                                    <value>${basedir}/src/main/resources/application-grammars.xml</value>
                                </property>
                            </properties>
                        </wadlGeneratorDescription>
                        <wadlGeneratorDescription>
                            <className>
                                com.sun.jersey.server.wadl.generators.resourcedoc.WadlGeneratorResourceDocSupport
                            </className>
                            <properties>
                                <property>
                                    <name>resourceDocFile</name>
                                    <value>${project.build.outputDirectory}/resourcedoc.xml</value>
                                </property>
                            </properties>
                        </wadlGeneratorDescription>
                    </wadlGenerators>
                </configuration>
          </plugin>
-->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-artifact</id>
                        <phase>package</phase>
                        <goals>
                            <goal>attach-artifact</goal>
                        </goals>
                        <configuration>
                            <artifacts>
                                <artifact>
                                    <file>${project.build.directory}/schema/camel-web.xsd</file>
                                    <type>xsd</type>
                                </artifact>
                            </artifacts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <inherited>true</inherited>
                <dependencies>
                  <!-- need JAXB on the classpath to use the xjc SchemaGenTask -->
                  <dependency>
                    <groupId>com.sun.xml.bind</groupId>
                    <artifactId>jaxb-core</artifactId>
                    <version>${jaxb-version}</version>
                  </dependency>
                  <dependency>
                    <groupId>com.sun.xml.bind</groupId>
                    <artifactId>jaxb-impl</artifactId>
                    <version>${jaxb-version}</version>
                  </dependency>
                  <dependency>
                    <groupId>com.sun.xml.bind</groupId>
                    <artifactId>jaxb-xjc</artifactId>
                    <version>${jaxb-version}</version>
                  </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>process-sources</id>
                        <phase>process-classes</phase>
                        <configuration>
                            <target>
                                <taskdef name="schemagen" classname="com.sun.tools.jxc.SchemaGenTask" classpathref="maven.plugin.classpath" />

                                <echo>Copying to code together for the XSD generation</echo>
                                <mkdir dir="${project.build.directory}/schema-src" />
                                <mkdir dir="${project.build.directory}/schema" />
                                <copy todir="${project.build.directory}/schema-src">
                                    <fileset dir="${basedir}/src/main/java">
                                        <include name="org/apache/camel/web/model/Camel.java" />
                                        <include name="org/apache/camel/web/model/EndpointLink.java" />
                                        <include name="org/apache/camel/web/model/Endpoints.java" />
                                        <include name="org/apache/camel/web/model/Route.java" />
                                        <include name="org/apache/camel/web/model/package-info.java" />
                                    </fileset>
                                </copy>

                                <echo>Generating XSD schema</echo>
                                <schemagen srcdir="${project.build.directory}/schema-src" destdir="${project.build.directory}/schema">
                                    <schema namespace="http://camel.apache.org/schema/web" file="camel-web.xsd" />
                                    <classpath refid="maven.compile.classpath" />
                                </schemagen>

                                <copy todir="${project.build.directory}/classes">
                                  <fileset dir="${project.build.directory}/schema" />
                                </copy>

                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

        </plugins>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <configuration>
                        <artifactItems>
                            <artifactItem>
                                <groupId>org.apache.camel</groupId>
                                <artifactId>camel-web</artifactId>
                                <version>${project.version}</version>
                                <type>xsd</type>
                                <overWrite>false</overWrite>
                                <outputDirectory>${project.build.directory}/schema</outputDirectory>
                                <destFileName>camel-web.xsd</destFileName>
                            </artifactItem>
                        </artifactItems>
                    </configuration>
                </plugin>
                <!-- Eclipse m2e Lifecycle Management -->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>${lifecycle-mapping-version}</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.apache.maven.plugins</groupId>
                                        <artifactId>maven-antrun-plugin</artifactId>
                                        <versionRange>${maven-antrun-plugin-version}</versionRange>
                                        <goals>
                                            <goal>run</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore />
                                    </action>
                                </pluginExecution>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.scalatra.scalate</groupId>
                                        <artifactId>maven-scalate-plugin_2.11</artifactId>
                                        <versionRange>${scalate-version}</versionRange>
                                        <goals>
                                            <goal>precompile</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore />
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>osgi</id>
            <properties>
                <osgi.export.pkg>
                    org.apache.camel.web.resources
                </osgi.export.pkg>
                <osgi.import.pkg>
                    com.sun.jersey.api.view;resolution:=optional,
                    com.sun.jersey.api.core;resolution:=optional,
                    com.sun.jersey.server.impl.container;resolution:=optional,
                    com.sun.jersey.server.impl.container.config;resolution:=optional,
                    com.sun.jersey.spi.container;resolution:=optional,
                    com.sun.jersey.spi.inject;resolution:=optional,
                    com.sun.jersey.spi.resource;resolution:=optional,
                    com.sun.jersey.spi.spring.container.servlet;resolution:=optional,
                    com.sun.org.apache.xerces.internal.jaxp;resolution:=optional,
                    com.sun.research.ws.wadl;resolution:=optional,
                    com.sun.xml.bind.v2.ContextFactory;resolution:=optional,
                    javax.annotation;resolution:=optional,
                    javax.el;resolution:=optional,
                    javax.naming;resolution:=optional,
                    javax.servlet;resolution:=optional,
                    javax.servlet.http;resolution:=optional,
                    javax.servlet.jsp;resolution:=optional,
                    javax.servlet.jsp.el;resolution:=optional,
                    javax.servlet.jsp.tagext;resolution:=optional,
                    javax.servlet.jsp.jstl.core;resolution:=optional,
                    javax.servlet.resources;resolution:=optional,
                    javax.ws.rs;resolution:=optional,
                    javax.ws.rs.core;resolution:=optional,
                    javax.ws.rs.ext;resolution:=optional,
                    javax.xml;resolution:=optional,
                    javax.xml.bind;resolution:=optional,
                    javax.xml.bind.annotation;resolution:=optional,
                    javax.xml.bind.annotation.adapters;resolution:=optional,
                    javax.xml.bind.attachment;resolution:=optional,
                    javax.xml.bind.helpers;resolution:=optional,
                    javax.xml.bind.util;resolution:=optional,
                    javax.xml.namespace;resolution:=optional,
                    javax.xml.parsers;resolution:=optional,
                    org.apache.camel;version="[2.8, 3.0)",
                    org.apache.camel.builder;version="[2.8, 3.0)",
                    org.apache.camel.impl;version="[2.8, 3.0)",
                    org.apache.camel.impl.converter;version="[2.8, 3.0)",
                    org.apache.camel.model;version="[2.8, 3.0)",
                    org.apache.camel.spi;version="[2.8, 3.0)",
                    org.apache.camel.spring;version="[2.8, 3.0)",
                    org.apache.camel.osgi;version="[2.8, 3.0)",
                    org.apache.camel.util;version="[2.8, 3.0)",
                    org.apache.camel.web.resources;resolution:=optional,
                    org.apache.commons.logging;resolution:=optional,
                    org.osgi.service.http;version="[1.0.0,2.0.0)",
                    org.ops4j.pax.web.service;resolution:=optional,
                    org.w3c.dom;resolution:=optional,
                    org.xml.sax;resolution:=optional,
                    org.xml.sax.helpers;resolution:=optional,
                    org.springframework.aop.support;version="[3, 4)",
                    org.springframework.context;version="[3, 4)",
                    org.springframework.util;version="[3, 4)",
                    org.springframework.beans.factory;version="[3, 4)",
                    org.springframework.beans.factory.config;version="[3, 4)",
                    org.springframework.beans.factory.xml;version="[3, 4)",
                    org.springframework.jmx.export.metadata;version="[3, 4)",
                    org.springframework.web.context;version="[3, 4)",
                    org.springframework.web.context.support;version="[3, 4)",
                    org.springframework.osgi.web.context.support;version="[1.0, 2.0)"
                </osgi.import.pkg>
                <osgi.classpath>
                    .,
                    WEB-INF/classes,
                    WEB-INF/lib/jline-${jline-version}.jar,
                    WEB-INF/lib/jersey-core-${jersey-version}.jar,
                    WEB-INF/lib/jersey-server-${jersey-version}.jar,
                    WEB-INF/lib/jersey-spring-${jersey-version}.jar,
                    WEB-INF/lib/jersey-json-${jersey-version}.jar,
                </osgi.classpath>
                <osgi.private.pkg />
                <osgi.dynamic>*</osgi.dynamic>
                <webApplicationContext>camelweb</webApplicationContext>
            </properties>

            <!-- Add scope provided to avoid that jar is copied to WEB-INF/lib -->
            <dependencies>
                <dependency>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>org.apache.camel</groupId>
                    <artifactId>camel-core</artifactId>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>org.apache.camel</groupId>
                    <artifactId>camel-spring</artifactId>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>com.sun.jersey.contribs</groupId>
                    <artifactId>jersey-spring</artifactId>
                    <version>${jersey-version}</version>
                    <exclusions>
                        <exclusion>
                            <groupId>org.springframework</groupId>
                            <artifactId>spring</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>org.springframework</groupId>
                            <artifactId>spring-core</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>org.springframework</groupId>
                            <artifactId>spring-beans</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>org.springframework</groupId>
                            <artifactId>spring-context</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>org.springframework</groupId>
                            <artifactId>spring-web</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>org.apache.servicemix.specs</groupId>
                            <artifactId>org.apache.servicemix.specs.activation-api-1.1</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>org.apache.servicemix.specs</groupId>
                            <artifactId>org.apache.servicemix.specs.jaxb-api-2.1</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>org.apache.servicemix.specs</groupId>
                            <artifactId>org.apache.servicemix.specs.stax-api-1.0</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>org.apache.servicemix.bundles</groupId>
                            <artifactId>org.apache.servicemix.bundles.jaxb-impl</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
                <dependency>
                    <groupId>com.sun.jersey</groupId>
                    <artifactId>jersey-core</artifactId>
                    <version>${jersey-version}</version>
                    <exclusions>
                        <exclusion>
                            <groupId>org.apache.servicemix.specs</groupId>
                            <artifactId>org.apache.servicemix.specs.activation-api-1.1</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>org.apache.servicemix.specs</groupId>
                            <artifactId>org.apache.servicemix.specs.jaxb-api-2.1</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>org.apache.servicemix.specs</groupId>
                            <artifactId>org.apache.servicemix.specs.stax-api-1.0</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>org.apache.servicemix.bundles</groupId>
                            <artifactId>org.apache.servicemix.bundles.jaxb-impl</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
                <dependency>
                    <groupId>com.sun.jersey</groupId>
                    <artifactId>jersey-server</artifactId>
                    <version>${jersey-version}</version>
                    <exclusions>
                        <exclusion>
                            <groupId>org.apache.servicemix.specs</groupId>
                            <artifactId>org.apache.servicemix.specs.activation-api-1.1</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>org.apache.servicemix.specs</groupId>
                            <artifactId>org.apache.servicemix.specs.jaxb-api-2.1</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>org.apache.servicemix.specs</groupId>
                            <artifactId>org.apache.servicemix.specs.stax-api-1.0</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>org.apache.servicemix.bundles</groupId>
                            <artifactId>org.apache.servicemix.bundles.jaxb-impl</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>

                <dependency>
                    <groupId>com.sun.jersey</groupId>
                    <artifactId>jersey-json</artifactId>
                    <version>${jersey-version}</version>
                    <exclusions>
                        <exclusion>
                            <groupId>org.apache.servicemix.specs</groupId>
                            <artifactId>org.apache.servicemix.specs.activation-api-1.1</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>org.apache.servicemix.specs</groupId>
                            <artifactId>org.apache.servicemix.specs.jaxb-api-2.1</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>org.apache.servicemix.specs</groupId>
                            <artifactId>org.apache.servicemix.specs.stax-api-1.0</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>org.apache.servicemix.bundles</groupId>
                            <artifactId>org.apache.servicemix.bundles.jaxb-impl</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>org.codehaus.jackson</groupId>
                            <artifactId>jackson-core-asl</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>org.codehaus.jackson</groupId>
                            <artifactId>jackson-mapper-asl</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>org.codehaus.jackson</groupId>
                            <artifactId>jackson-jaxrs</artifactId>
                        </exclusion>
                        <exclusion>
                            <groupId>org.codehaus.jackson</groupId>
                            <artifactId>jackson-xc</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
		        <!-- jackson for jersey-json -->
		        <dependency>
		            <groupId>org.codehaus.jackson</groupId>
		            <artifactId>jackson-core-asl</artifactId>
		            <version>${jackson-version}</version>
		        </dependency>
		        <dependency>
		            <groupId>org.codehaus.jackson</groupId>
		            <artifactId>jackson-mapper-asl</artifactId>
		            <version>${jackson-version}</version>
		        </dependency>
		        <dependency>
		            <groupId>org.codehaus.jackson</groupId>
		            <artifactId>jackson-jaxrs</artifactId>
		            <version>${jackson-version}</version>
		        </dependency>
		        <dependency>
		            <groupId>org.codehaus.jackson</groupId>
		            <artifactId>jackson-xc</artifactId>
		            <version>${jackson-version}</version>
		        </dependency>

                <dependency>
                    <groupId>com.sun.jersey</groupId>
                    <artifactId>jersey-atom</artifactId>
                    <version>${jersey-version}</version>
                    <scope>provided</scope>
                </dependency>

                <dependency>
                    <groupId>javax.annotation</groupId>
                    <artifactId>jsr250-api</artifactId>
                    <optional>true</optional>
                    <scope>provided</scope>
                </dependency>

                <dependency>
                    <groupId>jline</groupId>
                    <artifactId>jline</artifactId>
                    <version>${jline-version}</version>
                </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>
                        <executions>
                            <execution>
                                <id>bundle-manifest</id>
                                <phase>process-classes</phase>
                                <goals>
                                    <goal>manifest</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <manifestLocation>META-INF</manifestLocation>
                            <supportedProjectTypes>
                                <supportedProjectType>bundle</supportedProjectType>
                                <supportedProjectType>war</supportedProjectType>
                            </supportedProjectTypes>
                            <instructions>
                                <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                                <Bundle-ClassPath>${osgi.classpath}</Bundle-ClassPath>
                                <Import-Package>${osgi.import.pkg}</Import-Package>
                                <Export-Package>${osgi.export.pkg}</Export-Package>
                                <Webapp-Context>${webApplicationContext}</Webapp-Context>
                                <DynamicImport-Package>${osgi.dynamic}</DynamicImport-Package>
                                <_failok>true</_failok>
                            </instructions>
                        </configuration>

                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-war-plugin</artifactId>
                        <configuration>
                            <attachClasses>true</attachClasses>
                            <!-- <packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes> -->
                            <archive>
                                <!-- add the generated manifest to the war -->
                                <manifestFile>META-INF/MANIFEST.MF</manifestFile>
                            </archive>
                            <webResources>
                                <resource>
                                    <directory>${basedir}/src/main/webapp</directory>
                                    <excludes>
                                        <exclude>**/web.xml</exclude>
                                        <exclude>**/applicationContext.xml</exclude>
                                    </excludes>
                                </resource>
                                <!-- web.xml file modified for OSGI -->
                                <resource>
                                    <directory>${basedir}/src/profiles/osgi/webapp</directory>
                                </resource>
                                <resource>
                                    <directory>${basedir}/src/main/resources</directory>
                                </resource>
                            </webResources>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
